Embodiment
Below in conjunction with accompanying drawing, a kind of page display control method provided by the invention, server and system are described in detail with specific embodiment.
The page display control method that the embodiment of the invention provides as shown in Figure 1, comprises following step:
Step S101, client are initiated the accession page request, certain WEB page of request visit.
Step S102, server receive the accession page request that client is initiated; And return corresponding page content-data and initialization script according to this accession page request.
Server end can be added on predefined initialization script the end of content of pages, and content of pages can be set temporarily not show, correspondingly shows after server returns the display control information of this page again.
Step S103, client executing initialization script send page control request to server.
Among this step S103, generally carry out the initialization script by the browser of client.
Step S104, server receive the page control request that client is sent, and according to this page control request, the display control information of the page that reads in the configuration file to be asked, and the renderer of choosing this page correspondence.
Step S105, client are controlled this page and are correspondingly shown according to the display control information and the renderer that return.
In the embodiment of the invention, the pre-defined page display properties collection of node (corresponding to certain page or the catalogue in the website), page display properties collection is one group of key-value pair, each key-value pair expression formula is: display properties name=display attribute value.
The display properties name includes but not limited to: overall pattern, gauge outfit pattern, interlacing pattern, back gauge pattern, cell style, title pattern.
When display properties was called overall pattern, corresponding display attribute value comprised: tabulation type, list type and displaying type etc.;
During the by name gauge outfit pattern of display properties, corresponding display attribute value comprises: common, overstriking and background intensification etc.;
During the by name interlacing pattern of display properties, corresponding display attribute value comprises: common and background etc. alternately;
When display properties was called the back gauge pattern, corresponding display attribute value comprised: typical values and good value etc.;
When display properties was called cell style, corresponding display attribute value comprised: common, and consistent blank (Padding), long and narrow Padding;
When display properties was called title lattice pattern, corresponding display attribute value included but not limited to: and common, overstriking, background is deepened }, common, occupy a left side, the residence is right, and is placed in the middle }.
The storage format of the display properties collection of definition is as follows:
<DisplayAttrSet?name=”displayattrset_name”>
<DisplayAttr?name=”disname1”value=”disvalue1”/>
<DisplayAttr?name=”disname2”value=”disvalue2”/>
......
</DisplayAttrSet>
Wherein, disname1 and disname2 represent each display properties name respectively, and disvalue1 and disvalue2 represent the display attribute value of each display properties name correspondence respectively.
The also pre-defined page function type attribute of node in the embodiment of the invention, page function type attribute represents that with fx its parameter value includes but not limited to: increase, revise, tabulate and check.The page functional attributes storage format of definition for example is: type=" f
x".
According to predefined page display properties collection and page function type attribute, can be pre-defined go out configuration file.
Configuration file can use the XML language to write.Following code is example of configuration file.
<?xml?version=″1.0″encoding=″UTF-8″?>
<DisplayConfiversion=”1.0”>
<DisplayAttrSets>
<DisplayAttrSet?name=”displayattrset?name”>
<DisplayAttr?name=”disname?1”value=”disvalue?1”/>
<DisplayAttr?name=”disname2”value=”disvalue2”/>
......
</DisplayAttrSet>
</DisplayAttrSets>
<NodeX?type=”f
x”/>
<NodeY?type=”f
x”>
<DisplayAttrSet>
<DisplayAttr?name=”disname?1”value=”disvalue?1”/>
<DisplayAttr?name=”disname2”value=”disvalue2”/>
......
</DisplayAttrSet>
<NodeZ?type=”f
x”>
<DisplayAttrSet>
<DisplayAttr?name=”disname?1”value=”disvalue?1”/>
<DisplayAttr?name=”disname2”value=”disvalue2”/>
......
</DisplayAttrSet>
<NodeXXX/>
</NodeZ>
</NodeY>
......
</DisplayConfig>
In above-mentioned configuration file, comprised the display control information of node (Node) X, node Y, node Z and any multistage node Node XXX.Each node can comprise the parameter value of page display properties collection, perhaps comprises pre-defined functional attributes parameter value.
Below in conjunction with above-mentioned explanation, the concrete implementation of step S104 shown in Figure 1 and step S105 is described further configuration file.
In step S104, server receives after the page control request that client sends, and starts and carries out a pick-up program, and the main effect of this pick-up program is to be used for determining the display control information of this page and choosing corresponding renderer.Concrete workflow comprises as shown in Figure 2:
Step S201, server are according to unified resource positioning mark (the Uniform Resource Locator of requested page in the page control request, URL), what generate correspondence expands language (eXtensibleMarkup Language based on sign, XML) path searching language (XML Path Language, XPath) path.
The XPath path uses the back slash symbol to separate the title of XML node at all levels (leaf node and the directory node that comprise tree), is similar to document directory structure FilePath.Generate the scope that corresponding XPath path belongs to prior art according to URL, no longer describe in detail in embodiments of the present invention.
Step S202, execution XPath path search whether there is corresponding node in configuration file.If exist, carry out following step S203; If do not exist, carry out following step S208.
When carrying out the corresponding XPath path that generates of URL according to the page first, the XPath path is the node of this page correspondence (hereinafter to be referred as first node) just, carry out the process in XPath path, just in configuration file, search the node that whether has this page correspondence.If there is first node; Carry out following step S203; If do not have, carry out following step S208.
After following step S208, the XPath path has promoted one deck, and during execution in step S202, what search is the node (node of the upper directory correspondence of this page just) of the XPath path correspondence after promoting once more.
Step S203, judge whether this node exists page display properties collection DisplayAttrSet child node; If there is execution in step S204; If do not exist, turn to execution in step S205.
Step S204, read the parameter value of page display properties collection DisplayAttrSet, and choose conventional renderer, the parameter value of the page display properties collection that reads is back to client with conventional renderer.
In the embodiment of the invention, can pre-defined conventional renderer, specific renderer and acquiescence renderer etc., renderer can use script Javascript to realize, (Dynamic HTML, DHTML) technology is controlled and is handled the demonstration and the effect of all labels on the page based on Dynamic Hyper Text Makeup Language.
Each renderer possesses one and describes head, and the concrete form of describing head for example is:
struct?RENDER_INFO
{
The renderer type;
The renderer title;
Version number;
}
Server enumerates predefined all renderers when carrying out initialization, read the description head of all renderers, and be buffered in the internal memory, is convenient to read rapidly.
Step S205, judge whether this node exists the function type attribute; If there is execution in step S206; If do not exist, turn to step S207.
Step S206, read functions type attribute f
xValue, and choose and f
xThe corresponding specific renderer and the parameter value of corresponding page display properties collection (predefined), parameter value and the specific renderer of choosing with the page display properties collection that read are back to client.
Choosing of specific renderer can be chosen by reading its renderer type of describing in the head, chooses renderer type=f
XThat specific renderer return client and get final product.
Step S207, choose the acquiescence renderer be back to client.
Step S208, according to the order of each layer in the XPath path, carry out the path of first node next-door neighbour's last layer node, just the XPath path is promoted one deck.
In the embodiment of the invention, after the step S208, turn to the flow process of repeated execution of steps S202 or step S208.By repeated execution of steps S202 or step S208, continuous each upper layer node of searching first node in configuration file is up to the upper layer node that finds first node (may be the node of certain one deck more than the first node).When the upper layer node that in configuration file, finds first node, to the process that step S207 describes, read the parameter value of this upper layer node corresponding page display properties collection according to abovementioned steps S203, and select corresponding renderer.The parameter value of the page display properties collection that reads and the renderer of choosing are back to client.The whole flow process of the page display control method that the embodiment of the invention provides is end loop so far.
After client receives the display control information and renderer that server returns, as shown in Figure 3, carry out following step:
The renderer that step S301, client executing are returned.
Step S302, renderer reading displayed control information (parameter value of page display properties collection) with wherein each attribute item and parameter value, are defined as the global parameter of current renderer work.
Step S303, renderer are provided with the pattern of the level of this page according to the global parameter of determining.
Step S304, renderer are determined the main tag block of full page.
Step S305, renderer empty the mixed and disorderly pattern of the page-tag outside the main tag block.
Step S306, renderer are handled the label in the main tag block.
In step S306, the details of processing for example can comprise: deal with data tabulation gauge outfit for example is the tabulation type page; Handle each row of data, and whether decision uses the interlacing pattern according to global parameter, deepens background etc.; Handle for example pattern of title bar of particular column; The pattern of padding in the processing unit lattice etc.; Handle all and singly select check box pattern, all input frame patterns or all button patterns; Handle the pattern dependent event, this row background colour changes when moving to certain row such as mouse, and background colour recovers or the like when shifting out.
Client executing step S301 makes the demonstration of the page reach predefined effect to step S306.
The embodiment of the invention also provides a kind of server, as shown in Figure 4, comprising: receiving element 401, read/choose unit 402 and return unit 403; Wherein:
Receiving element 401 is used to receive the page control request that client is sent;
Read/choose unit 402, be used for according to page control request, the display control information of the page that reads in the configuration file to be asked, and choose corresponding renderer;
Return unit 403, be used for display control information that to read and the renderer of choosing and be back to client.
Reading in the server that the embodiment of the invention provides/choose unit 402 also is used for the unified resource positioning mark URL of this page of carrying according to page control request, generates corresponding XPath path;
According to the order of each node in the XPath path, from configuration file, search and read the display control information of this page successively, and the renderer of choosing this page correspondence.
Further, read/choose unit 402, also be used for searching the first node of this page correspondence at configuration file;
When having first node, judge whether first node exists page display properties collected works node in the configuration file; If exist, read the parameter value of page display properties collection, the parameter value and the conventional renderer of page display properties collection is back to this client;
If do not exist, judge whether first node exists the function type attribute in the configuration file; If exist, the parameter value of read functions type attribute, and read with the parameter value of function type property parameters value corresponding page display properties collection and choose corresponding specific renderer, the parameter value of the page display properties collection that reads and the specific renderer of choosing are back to this client; If do not exist, will give tacit consent to renderer and be back to this client;
When not having first node,, in configuration file, search each upper layer node of first node successively, until finding upper layer node according to the order in XPath path; Read the parameter value of the upper layer node corresponding page display properties collection that finds, and choose corresponding renderer, the parameter value of the page display properties collection that reads and the renderer of choosing are back to this client.
The embodiment of the invention also provides a kind of page display control program, as shown in Figure 5, comprising: server 501 and client 501;
Server 501 is used to receive the page control request that client is sent; According to page control request, the display control information of the page that reads in the configuration file to be asked, and choose corresponding renderer; Display control information that reads and the renderer of choosing are back to client 502;
Client 502 is used for the display control information and the renderer that return according to server 501, and the control page shows.
Further, server 501 also is used to receive the accession page request that client is initiated; And return corresponding page content-data and initialization script according to this accession page request;
Client 502 also is used for initiating the accession page request to server 501, and carries out the initialization script that server 501 returns, and sends page control information request to server 502.
Further, server 501 also is used for the unified resource positioning mark URL of the page that carries according to page control request, generates corresponding XPath path; According to the order of each node in the XPath path, from configuration file, search and read the display control information of this page successively, and the renderer of choosing this page correspondence.
The page display control method that the embodiment of the invention provides, after server receives the page control request that client sends, the display control information of the page that reads in the configuration file to be asked, and choose corresponding renderer, the display control information and the renderer that read are returned to client, client is according to the display control information and the renderer that receive, the control page shows accordingly, the embodiment of the invention is the pre-defined demonstration and the pattern control information of all pages in the station system in configuration file, for needs format content displayed, can realize unified the setting, for special content displayed, also can carry out the independent demonstration and the definition of style format in advance, easy to use flexible, any one page for the client-requested visit, the method that can provide by the embodiment of the invention, server and system, reach predefined display effect, and whole process can realize in automation, no longer need manually to intervene, avoided existing manually be provided with development process in, the workload of being brought is heavy, the problem that efficient is lower.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.