Summary of the invention
In view of the foregoing deficiencies of prior art, the purpose of the present invention is to provide one kind to be based on embedded type WEB service
The method and system of device dynamic generation menu bar are complicated when for solving to generate or replace in the prior art menu bar, be easy
Wrong problem.
In order to achieve the above objects and other related objects, the present invention provides a kind of raw based on flush type WEB server dynamic
At the method for menu bar, for generating menu bar on a web browser, which comprises deposit the information for being used to generate menu bar
It is placed in specified file;Life is added for menu bar predeterminated position to be generated and inside index.html file in a browser
At the function interface of menu bar, while browser sends menu bar to WEB server and generates request;Described in WEB server parsing
Browser send request message, obtain the specified file file name and the index.html file;According to institute
The function interface stated in specified file and index.html file adds the information for being used to generate menu bar according to html language
New index.html file is formed in the index.html file;The WEB server will be described new
Index.html file returns to browser, so that the browser is according to the new index.html file in default position
Set generation menu bar.
Preferably, the information for generating menu bar includes menu bar title and URL link address.
Preferably, under serial ports mode, the information for being used to generate menu bar in the specified file is modified.
Preferably, the specified file is the file of TXT format.
Preferably, the WEB server is got by open function according to the file name of the specified file specified
File.
To achieve the above object, the present invention also provides a kind of browser of dynamic generation menu bar, the browser includes:
Menu bar file module, for the information for being used to generate menu bar to be stored in specified file;The default arrangement module in position, is used
In being in a browser menu bar predeterminated position to be generated;Function interface module, for adding inside index.html file
Add the function interface for generating menu bar;Request sending module, with the menu bar file module, the default arrangement module in the position
And the function interface module is connected, and generates request for sending menu bar to WEB server;Menu bar generation module, with
The WEB server is connected, and the new index.html file returned according to the WEB server generates menu in predeterminated position
Column.
Preferably, described for generate the information of menu bar to include menu bar title and URL link address.
Preferably, under serial ports mode, the information for being used to generate menu bar in the specified file is modified;It is described specified
File is the file of TXT format.
To achieve the above object, the present invention also provides a kind of WEB servers of dynamic generation menu bar, in browser
Upper generation menu bar, the WEB server include: packet parsing module, for parsing the report for the request that the browser is sent
Text;Data obtaining module is connected with the packet parsing module, for obtain in the message file name of specified file and
Index.html file;Message processing module is connected with the data obtaining module, for according to the specified file and described
The information for being used to generate menu bar is added to described by the function interface in index.html file according to html language
New index.html file is formed in index.html file;Information return module is connected with the message processing module, uses
In the new index.html file is returned to browser, so that the browser is according to the new index.html
File generates menu bar in predeterminated position.
To achieve the above object, it is based on flush type WEB server dynamic generation menu bar the present invention also provides a kind of
System, the system comprises browsers as described above and WEB server as described above.
As described above, a kind of method and system based on flush type WEB server dynamic generation menu bar of the invention, tool
Have it is following the utility model has the advantages that
1, menu bar and URL link in the present invention, are stored in external file, so that menu bar is independent, more
Change link or menu bar title, it is only necessary to change external file, allowing is not to understand that very much the people of html language can also be voluntarily
Modification is not needed to remove to open corresponding html file every time, reduces error rate.
It 2, in the present invention, can be without compiling and burning image file, it is only necessary to pass through serial mode
Arbitrarily it can be modified and be debugged, change menu bar can also be removed when communication equipment runs shape, be eliminated every time only
Can by the method for burning image file go change menu bar, debug get up it is more convenient, substantially increase debugging efficiency.
3, in the present invention, parse external file, completed inside flush type WEB server so that the present invention have compared with
Strong versatility and practicability.
Specific embodiment
Illustrate embodiments of the present invention below by way of specific specific example, those skilled in the art can be by this specification
Other advantages and efficacy of the present invention can be easily understood for disclosed content.The present invention can also pass through in addition different specific realities
The mode of applying is embodied or practiced, the various details in this specification can also based on different viewpoints and application, without departing from
Various modifications or alterations are carried out under spirit of the invention.
The purpose of the present invention is to provide a kind of method based on flush type WEB server dynamic generation menu bar and it is
System, for solving the problems, such as complexity when generating or replace menu bar in the prior art, being easy error.Described in detail below hair
A kind of principle and embodiment of bright method and system based on flush type WEB server dynamic generation menu bar, makes ability
Field technique personnel do not need creative work and are appreciated that one kind of the invention is based on flush type WEB server dynamic generation menu
The method and system on column.
First embodiment
The present embodiment provides a kind of method based on flush type WEB server dynamic generation menu bar, the present embodiment is solved
The function for generating menu is terminated in WEB by traditional method for only going parsing to generate menu bar by the page oneself itself, the present embodiment
In server, the page only needs to provide a storage menu bar position, is added below in corresponding root, such as TMP file
The TXT file of navigation bar title and chained address, WEB server receive the request that browser sends over, when parsing data,
Check whether it is index.html, therefrom find the interface for needing to parse menu bar, by the content inside TXT file according to
The format of html language is added in html file, and returns to browser, and reduction browser interacts number with web server in this way
According to amount, interactive efficiency is improved, developer changes faster convenience.
As described in Figure 1, the method based on flush type WEB server dynamic generation menu bar includes the following steps.
The information for being used to generate menu bar is stored in specified file by step S11.
Step S12 adds for menu bar predeterminated position to be generated and inside index.html file in a browser
The function interface of menu bar is generated, while browser sends menu bar to WEB server and generates request.
Step S13, WEB server parse the message for the request that the browser is sent, obtain the text of the specified file
Part title and the index.html file.
Step S14 will be used to generate menu bar according to the function interface in the specified file and index.html file
Information be added in the index.html file according to html language and form new index.html file.
Step S15, the new index.html file is returned to browser by the WEB server, so that described
Browser generates menu bar in predeterminated position according to the new index.html file.
Step S11 and step S15 are described in detail below.
In step s 11, the information for being used to generate menu bar is stored in specified file.Specifically, in the present embodiment
In, the specified file is the file of TXT format, and information for generating menu bar includes menu bar title and URL link
Location.
URL, that is, uniform resource locator is one to the position of the resource that can be obtained from internet and access method
The succinct expression of kind, is the address of standard resource on internet.Each file on internet has a unique URL, it
The information for including points out how the position of file and browser should handle it.
In addition, in the present embodiment, while the file of this TXT format is stored in the root of browser, such as TMP catalogue
Under, such as in TMP file the TXT file comprising navigation bar title and URL link address, the power of TMP file is added below
Be limited to it is readable writeable, it is convenient temporarily to go to change.
In the present embodiment, menu bar and URL link are stored in specified file (external file), so that menu bar is independent
Out, when changing URL link or menu bar title, it is only necessary to change external file, allowing is not to understand very much html language
People can also voluntarily modify, do not need to go to open every time corresponding html file, reduce error rate.
Furthermore, it is possible to modify the information for being used to generate menu bar in the specified file under serial ports mode.So this
The method of invention can be without compiling and burning image file, it is only necessary to can be carried out arbitrarily by serial mode
Modification and debugging, can also communication equipment run shape when go change menu bar, eliminating every time can only be by burning mirror
As the method for file go change menu bar, debugging get up it is more convenient, substantially increase debugging efficiency.
Step S12 adds for menu bar predeterminated position to be generated and inside index.html file in a browser
The function interface of menu bar is generated, while browser sends menu bar to WEB server and generates request.Wherein, index.html
It is homepage, the homepage of most of website is all index.html.
First that page layout is good using CSS and HTML technology, at suitable position, (i.e. predeterminated position) arranges menu bar.
Wherein, CSS (cascading style sheets) is that one kind is used to show HTML (standard generalized markup language) or XML (standard generalized markup language
Speech) etc. files pattern computer language.CSS is can be truly realized webpage to show a kind of form design language separated with content
Speech.For the performance of conventional HTML, CSS can position typesetting to the object in webpage carry out the accurate control of Pixel-level
System, supports almost all of font size pattern, possesses the ability to web object and model pattern editor, and is able to carry out just
Interaction design is walked, is currently based on the classic performance design language of textual presentation.CSS can be according to the understanding of different users
Ability, simplifying or optimize literary style for various people has stronger legibility.
Step S13, WEB server parse the message for the request that the browser is sent, obtain the text of the specified file
Part title and the index.html file.
Step S14 will be used to generate menu bar according to the function interface in the specified file and index.html file
Information be added in the index.html file according to html language and form new index.html file.
Step S15, the new index.html file is returned to browser by the WEB server, so that described
Browser generates menu bar in predeterminated position according to the new index.html file.
Specifically, in the present embodiment, the WEB server analytic message, extracts the specified file from URL
File name, the WEB server get specified file according to the file name of the specified file by open function.Example
Such as, open ("/www/menu.txt ", O_RDONLY), that is, may know that specified file whether there is.As it can be seen that in the present embodiment,
External file is parsed, is completed inside flush type WEB server, so that the present invention has stronger versatility and practicability.
To make it is further understood that of the invention based on flush type WEB server dynamic generation menu
The method on column, below to illustrate the implementation process of the method for the present invention.
Pad name and URL are added in menu.txt file (specified file) in the form of array first:
Such as:
[quick guide, wizard_iframe.html];
[storage is shared, media.html];
[the shared setting of storage, shares.html];
[user management, password.html];
[WAN setting, wanCfg.html];
[LAN setting, lanCfg.html];
[MAC clone, macClone.html];
[operating mode, opmode.html];
Then the function interface for the generation menu bar that addition needs inside index.html, such as: "@interface function # ",
Menu bar, which is sent, to WEB server generates request.
Then inside flush type WEB server, the message that parsing browser sends over, request
Index.html, open function go to judge that menu.txt (specified file) whether there is, and check letter inside index.html file
Number interfaces whether there is, menu.txt and function interface all in the presence of, according to corresponding in the addition of html language format
Menu and the corresponding link of creation, group builds up HTTP message, and returns to browser, and the browser is according to described new
Index.html file generates menu bar in predeterminated position.So, so that addition menu bar is independent from code.
Second embodiment
To realize that the above-mentioned method based on flush type WEB server dynamic generation menu bar, the present embodiment correspondence mention
For a kind of system based on flush type WEB server dynamic generation menu bar, the present embodiment solves traditional only by the page oneself
The method for itself going parsing to generate menu bar, the present embodiment terminate in the function for generating menu in WEB server, and the page only needs
One storage menu bar position is provided, navigation bar title and chained address is added below in corresponding root, such as TMP file
TXT file, WEB server receives the request that browser sends over, and when parsing data, checking whether is
Index.html therefrom finds the interface for needing to parse menu bar, by the content inside TXT file according to the lattice of html language
Formula is added in html file, and returns to browser, in this way reduction browser and web server interaction data amount, improves
Interactive efficiency, developer change faster convenience.
Specifically, as shown in Fig. 2, the system 1 of dynamic generation menu bar includes 11 He of browser of dynamic generation menu bar
WEB server 12.
As shown in figure 3, browser 11 includes: menu bar file module 111, the default arrangement module 112, function interface in position
Module 113, request sending module 114 and menu bar generation module 115.
Menu bar file module 111 is for the information for being used to generate menu bar to be stored in specified file;Specifically, exist
In the present embodiment, the specified file be TXT format file, the information for generating menu bar include menu bar title and
URL link address.
URL, that is, uniform resource locator is one to the position of the resource that can be obtained from internet and access method
The succinct expression of kind, is the address of standard resource on internet.Each file on internet has a unique URL, it
The information for including points out how the position of file and browser 11 should handle it.
In addition, in the present embodiment, while the file of this TXT format is stored in the root of browser 11, such as TMP mesh
Under record, such as in TMP file the TXT file comprising navigation bar title and URL link address is added below, TMP file
Permission be it is readable writeable, it is convenient temporarily to go to change.
In the present embodiment, menu bar and URL link are stored in specified file (external file), so that menu bar is independent
Out, when changing URL link or menu bar title, it is only necessary to change external file, allowing is not to understand very much html language
People can also voluntarily modify, do not need to go to open every time corresponding html file, reduce error rate.
Furthermore, it is possible to modify the information for being used to generate menu bar in the specified file under serial ports mode.So this
The method of invention can be without compiling and burning image file, it is only necessary to can be carried out arbitrarily by serial mode
Modification and debugging, can also communication equipment run shape when go change menu bar, eliminating every time can only be by burning mirror
As the method for file go change menu bar, debugging get up it is more convenient, substantially increase debugging efficiency.
The default arrangement module 112 in position is for being menu bar predeterminated position to be generated in browser 11;Wherein,
Index.html is homepage, and the homepage of most of website is all index.html.
First that page layout is good using CSS and HTML technology, at suitable position, (i.e. predeterminated position) arranges menu bar.
Wherein, CSS (cascading style sheets) is that one kind is used to show HTML (standard generalized markup language) or XML (standard generalized markup language
Speech) etc. files pattern computer language.CSS is can be truly realized webpage to show a kind of form design language separated with content
Speech.For the performance of conventional HTML, CSS can position typesetting to the object in webpage carry out the accurate control of Pixel-level
System, supports almost all of font size pattern, possesses the ability to web object and model pattern editor, and is able to carry out just
Interaction design is walked, is currently based on the classic performance design language of textual presentation.CSS can be according to the understanding of different users
Ability, simplifying or optimize literary style for various people has stronger legibility.
Function interface of the function interface module 113 for the addition generation menu bar inside index.html file;
Request sending module 114 and the menu bar file module 111, the default arrangement module 112 in the position and institute
It states function interface module 113 to be connected, generates request for sending menu bar to WEB server 12.
Menu bar generation module 115 is connected with the WEB server 12, is returned according to the WEB server 12 new
Index.html file generates menu bar in predeterminated position.
As shown in figure 4, the WEB server 12 of the dynamic generation menu bar in the present embodiment, for raw on browser 11
At menu bar, the WEB server 12 includes: packet parsing module 121, data obtaining module 122, message processing module 123
With information return module 124.
Packet parsing module 121 is used to parse the message for the request that the browser 11 is sent.
Data obtaining module 122 is connected with the packet parsing module 121, for obtaining specified file in the message
File name and index.html file.
Message processing module 123 is connected with the data obtaining module 122, for according to the specified file and described
The information for being used to generate menu bar is added to described by the function interface in index.html file according to html language
New index.html file is formed in index.html file.
Information return module 124 is connected with the message processing module 123, for by the new index.html file
Browser 11 is returned to, so that the browser 11 generates menu in predeterminated position according to the new index.html file
Column.
Specifically, in the present embodiment, 12 analytic message of WEB server, extracts the specified file from URL
File name, the WEB server 12 gets specified text according to the file name of the specified file by open function
Part.For example, open ("/www/menu.txt ", O_RDONLY), that is, may know that specified file whether there is.As it can be seen that in this implementation
In example, external file is parsed, is completed inside flush type WEB server 12, so that the present invention has stronger versatility and reality
The property used.
To make it is further understood that of the invention based on 12 dynamic generation dish of flush type WEB server
The system 1 on single column, below to illustrate the implementation process of the method for the present invention.
Pad name and URL are added in menu.txt file (specified file) in the form of array first:
Such as:
[quick guide, wizard_iframe.html];
[storage is shared, media.html];
[the shared setting of storage, shares.html];
[user management, password.html];
[WAN setting, wanCfg.html];
[LAN setting, lanCfg.html];
[MAC clone, macClone.html];
[operating mode, opmode.html];
Then the function interface for the generation menu bar that addition needs inside index.html, such as: "@interface function # ",
Menu bar, which is sent, to WEB server 12 generates request.
Then in 12 the inside of flush type WEB server, the message that parsing browser 11 sends over, request
Index.html, open function go to judge that menu.txt (specified file) whether there is, and check letter inside index.html file
Number interfaces whether there is, menu.txt and function interface all in the presence of, according to corresponding in the addition of html language format
Menu and the corresponding link of creation, group builds up HTTP message, and returns to browser 11, and the browser 11 is according to described new
Index.html file predeterminated position generate menu bar.So, so that addition menu bar is independent from code.
In conclusion in the method and system of the invention based on flush type WEB server dynamic generation menu bar, it will
Menu bar and URL link are stored in external file, so that menu bar is independent, in change link or menu bar title, only
It needs to change external file, allowing is not to understand that very much the people of html language can also voluntarily modify, and does not need to go opening pair every time
The html file answered reduces error rate;The present invention can be without compiling and burning image file, it is only necessary to pass through
Serial mode arbitrarily can be modified and be debugged, and change menu bar can also be removed when communication equipment runs shape, is removed from
Change menu bar every time can only be removed by the method for burning image file, debugging is got up more convenient, substantially increases debugging effect
Rate;In addition, in the present invention, parsing external file, being completed inside flush type WEB server, so that the present invention has relatively by force
Versatility and practicability.So the present invention effectively overcomes various shortcoming in the prior art and has high industrial exploitation value
Value.
The above-described embodiments merely illustrate the principles and effects of the present invention, and is not intended to limit the present invention.It is any ripe
The personage for knowing this technology all without departing from the spirit and scope of the present invention, carries out modifications and changes to above-described embodiment.Cause
This, institute is complete without departing from the spirit and technical ideas disclosed in the present invention by those of ordinary skill in the art such as
At all equivalent modifications or change, should be covered by the claims of the present invention.