Summary of the invention
For solving the problems of the technologies described above, the embodiment of the present application provides a kind of page moduleization to generate method and system, content of pages is carried out to region division, module is carried out separately in each region to be called, generate respective page, avoid the nested same reference part of full page, in the time quoting part and need to change, the situation that need to modify to full page.
Technical scheme is as follows:
A kind of page moduleization generation method, comprising:
Definition page layout is the page area of multiple storage different contents by described page division;
Set up the call relation of described page area and functional module;
According to described call relation, described functional module is called;
Service logic in the functional module of calling described in parsing, generates the content of pages corresponding with described functional module according to described service logic.
Above-mentioned method, preferred, also comprise:
The process that the content of pages that the functional module that described multiple different page areas are called generates combines.
Above-mentioned method, preferred, the Cheng Qian excessively of combining at the described content of pages that functional module is generated, also comprises:
The process that the functional module that described multiple different page areas are called generates content of pages judges;
Judge whether functional module that described multiple different page areas call all completes the generative process of the content of pages corresponding with it.
Above-mentioned method, preferred, the process that generates content of pages corresponding to described functional module according to described service logic is specially:
The service logic of setting up described functional module realizes interface;
Obtain the content-data of described functional module according to described interface;
The content-data of described functional module is carried out associated with the pagefile in described functional module;
By described pagefile, the content-data of described functional module is generated as to content of pages.
Above-mentioned method, preferred, described module pagefile can associated multiple module contents data.
A kind of page module generation system, comprising:
Page definition unit, relation are set up unit, call unit, resolution unit and generation unit;
Wherein:
Described page definition unit is used for defining page layout, is the page area of multiple storage different contents by described page division;
Described relation is set up unit for setting up the page area of described page definition dividing elements and the call relation of functional module;
Described call unit calls described functional module for set up the call relation of setting up unit according to described relation;
Described resolution unit is for resolving the service logic of the functional module that described call unit calls;
Described generation unit generates the content of pages corresponding with described functional module for the service logic of resolving according to described resolution unit.
Above-mentioned system, preferred, also comprise: assembled unit;
Described assembled unit combines for the content of pages that described generation unit is generated.
Above-mentioned system, preferred, also comprise judging unit;
Described judging unit judges whether described generation unit completes the generative process of the content of pages corresponding to functional module before combining for the content of pages described generation unit being generated at described assembled unit.
Above-mentioned system, preferred, described generation unit comprises:
Interface is set up subelement, content obtaining subelement, associated subelement and is generated subelement;
Wherein:
Described interface is set up subelement and is realized interface for the service logic of setting up described functional module;
Described content obtaining subelement obtains the content-data of described functional module for set up the interface of subelement foundation according to described interface;
Described associated subelement carries out association for the pagefile of functional module described in the content-data territory of functional module that described content obtaining subelement is obtained;
Described generation subelement is for generating content of pages by described module pagefile by described module contents data.
The technical scheme being provided from above the embodiment of the present application, page moduleization provided by the invention generates method and system, the page is carried out to region division according to different storage contents, set up the call relation of each page area and functional module, independently call respectively different functional modules, generate content of pages corresponding to described functional module, described content of pages is to generate according to the service logic in described functional module.In the process of multiple page invocation equal modules, call relation between functional module is only set in different page areas, do not need the page code of same reference module just nested to full page, avoid in the service code of the nested full page of service code of equal modules, the degree of coupling of full page is increased, if the equal modules content of quoting in multiple pages needs to change, need the problem that part is modified of quoting in multiple pages.
Embodiment
In order to make those skilled in the art person understand better the application's scheme.Below in conjunction with the accompanying drawing in the embodiment of the present application, the technical scheme in the embodiment of the present application is clearly and completely described, obviously, described embodiment is only the application's part embodiment, rather than whole embodiment.Based on the embodiment in the application, those of ordinary skills are not making the every other embodiment obtaining under creative work prerequisite, all should belong to the scope of the application's protection.
The process flow diagram of the page moduleization generation method that the embodiment of the present application provides as shown in Figure 1, comprising:
Step S101: definition page layout is the page area of multiple storage different contents by described page division;
Be different page areas by page division, define the particular content of each page area storage;
Step S102: the call relation of setting up described page area and functional module;
By setting up the call relation of page area and functional module, each page area can independently be called to functional module;
Step S103: described functional module is called according to described call relation;
Different page areas calls the functional module corresponding with its content, has realized the page and has called by zones of different the mode that multiple modules generate;
Step S104: the service logic in the functional module of calling described in parsing, generates the content of pages corresponding with described functional module according to described service logic.
Because module is an independently Service Processing Unit, it has completely independently service code, completely independently page code; And module and homepage have same context relation, so be one by the final page and the homepage generating of module.In the page module generation method that the embodiment of the present invention provides, directly module is called, the content of pages that modules is generated merges, need to be in homepage nested module quote code, make the generation of the page more direct, the complex operation of having avoided bringing because code the is nested various problems such as easily make mistakes.
In the page module generation method that the embodiment of the present application provides, generate after each self-corresponding content of pages at each page area calling functional modules, also comprise the process that multiple different content of pages are combined, specifically as shown in Figure 3, comprise step S105: the content of pages that the functional module that multiple different page areas are called generates combines.
In conjunction with Fig. 1 and the described embodiment of Fig. 3, in order more clearly to introduce the division of page area and the call relation of page area and functional module, the application's embodiment of the method provides page area and functional module call relation schematic diagram, as shown in Figure 2, in homepage, the content that need to store according to each different page locations, homepage is divided into multiple page areas, the content of each page area storage, through pre-defined, arranges the call relation of the page area functional module corresponding with its storage content.
In Fig. 2, region A respective modules A, in the time that the page generates, region A calling module A, to the particular content in modules A, and in modules A, the logic that realizes of particular content is resolved, the content of pages that generation module A is corresponding; What carry out is that each self-corresponding module is called in other region simultaneously, generates corresponding content of pages, and each content of pages combines the most at last, obtains the demand page.
In the page module generative process that the embodiment of the present application provides, before content of pages combines, also comprise the deterministic process that each disparate modules is generated to page process, specific implementation process as shown in Figure 4, comprising: step S116: judge whether the functional module that multiple different page areas call all generates the content of pages corresponding with it; If so, execution step S105; Otherwise, execution step S117;
Step S117: the module that does not complete generating content is carried out to real-time judge, until the functional module of calling all generates the content of pages corresponding with it, finish deterministic process; Execution step S105.
In the description process of above embodiment of the method, generating the content of pages corresponding with described functional module according to described service logic is an important step, the method flow diagram according to content of pages corresponding to service logic systematic function module that the embodiment of the present application provides as shown in Figure 5, comprising:
Step S201: the service logic of setting up described functional module realizes interface;
Service logic in functional module exists with the form of class group, and first the realization of service logic class will set up the corresponding interface of logic class;
Step S202: the content-data that obtains described functional module according to described interface;
Realize logic class, when its main process, obtain content-data, the realization of the line correlation business of going forward side by side;
Step S203: the content-data of described functional module is carried out associated with the pagefile in described functional module;
Pagefile in module is static html file corresponding to module, and it is associated that the pagefile of module and service logic class are carried out, and carries out associated by the content-data in module with pagefile; Module pagefile can associated multiple logic class;
Step S104: the content-data of described functional module is generated as to content of pages by described pagefile.
Between the page that the embodiment of the present application provides and module, be related to that connection diagram as shown in Figure 6, as shown in Figure 6, homepage is by self page logic and pagefile, the layout framework that generates homepage, the particular content in its framework, is generated by page area calling functional modules, between homepage and module, use same upper and lower logical relation, modules is functional module completely independently, and between module and homepage, does not need linking relationship, there is no corresponding control of authority.
For aforesaid embodiment of the method, for simple description, therefore it is all expressed as to a series of combination of actions, but those skilled in the art should know, the present invention is not subject to the restriction of described sequence of movement, because according to the present invention, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in instructions all belongs to preferred embodiment, and related action and module might not be that the present invention is necessary.
For above embodiment of the method, the embodiment of the present application also provides a kind of page module generation system, its structural representation as shown in Figure 7, comprises that page definition unit 301, relation set up unit 302, call unit 303, resolution unit 304 and generation unit 305;
Wherein:
Page definition unit 301, for defining page layout, is the page area of multiple storage different contents by described page division;
Relation is set up unit 302 for the page area setting up described page definition unit 301 and divide and the call relation of functional module;
Call unit 303 calls described functional module for setting up according to described relation the call relation of setting up unit 302;
Resolution unit 304 is for the service logic of the functional module of resolving described call unit 303 and calling;
Generation unit 305 generates the content of pages corresponding with described functional module for the service logic of resolving according to described resolution unit 304.
On the basis of system shown in Figure 7, the detailed construction schematic diagram that the embodiment of the present application also provides page module generation system as shown in Figure 8, also comprises: assembled unit 306;
Assembled unit 306 combines for the content of pages that described generation unit 305 is generated.
On the basis of system shown in Figure 8, the another detailed construction schematic diagram that the embodiment of the present application provides page module generation system as shown in Figure 9, also comprises judging unit 307;
Before judging unit 307 combines for the content of pages described generation unit 305 being generated at described assembled unit 306, judge whether described generation unit 305 completes the generative process of the content of pages corresponding to functional module.
Figure 10 provides the detailed construction schematic diagram of generation unit in the embodiment of the present application; Generation unit 305 comprises:
Interface is set up subelement 401, content obtaining subelement 402, associated subelement 403 and is generated subelement 404;
Wherein:
Interface is set up subelement 401 and is realized interface for the service logic of setting up described functional module;
Content obtaining subelement 402 obtains the content-data of described functional module for set up interface that subelement 401 sets up according to described interface;
Associated subelement 403 carries out association for the pagefile of functional module described in the content-data territory of functional module that described content obtaining subelement 402 is obtained;
Generate subelement 404 for described module contents data being generated to content of pages by described module pagefile.
For system embodiment, because it is substantially corresponding to embodiment of the method, so description is fairly simple, relevant part is referring to the part explanation of embodiment of the method.
Embodiment of the method and system embodiment that comprehensive the embodiment of the present application provides, in the present invention, be the page area of storage different content by page division, call the functional module under complete separate state by page area, only realize the generative process to the page by calling module; Avoid in the service code of the nested full page of service code of equal modules, the degree of coupling of full page is increased, if the equal modules content of quoting in multiple pages needs to change, need the problem that part is modified of quoting in multiple pages.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, between each embodiment identical similar part mutually referring to, what each embodiment stressed is and the difference of other embodiment.The above is only the application's embodiment; it should be pointed out that for those skilled in the art, do not departing under the prerequisite of the application's principle; can also make some improvements and modifications, these improvements and modifications also should be considered as the application's protection domain.