Summary of the invention
For solving the problems of the technologies described above; The application embodiment provides a kind of page module generation method and system, and content of pages is carried out area dividing, and module invokes is carried out in each zone separately; Generate respective page; Avoided the nested same reference part of full page, when quoting part and need change, the situation that need make amendment to full page.
Technical scheme is following:
A kind of page module generation method comprises:
The definition page layout is the page area of a plurality of storage different contents with said page division;
Set up the call relation of said page area and functional module;
According to said call relation said functional module is called;
Resolve the service logic in the said functional module of calling, generate and said functional module corresponding page content according to said service logic.
Above-mentioned method, preferred, also comprise:
The process that the content of pages that the functional module that said a plurality of different page areas are called generates makes up.
Above-mentioned method, preferred, the Cheng Qian excessively in that the said content of pages that functional module is generated makes up also comprises:
The functional module that said a plurality of different page areas are called generates the process of content of pages and judges;
Judge whether functional module that said a plurality of different page areas call all accomplishes the generative process with its corresponding page content.
Above-mentioned method, preferred, the process that generates said functional module corresponding page content according to said service logic is specially:
The service logic of setting up said functional module realizes interface;
Obtain the content-data of said functional module according to said interface;
Carry out related with pagefile in the said functional module content-data of said functional module;
Through said pagefile the content-data of said functional module is generated as content of pages.
Above-mentioned method, preferred, said module pagefile can related a plurality of module contents data.
A kind of page module generation system comprises:
Page definition unit, relation are set up unit, call unit, resolution unit and generation unit;
Wherein:
Said page definition unit is used to define page layout, is the page area of a plurality of storage different contents with said page division;
Said relation is set up the unit and is used to set up the page area of said page definition dividing elements and the call relation of functional module;
Said call unit is used for setting up the call relation of setting up the unit according to said relation said functional module is called;
Said resolution unit is used for resolving the service logic of the functional module that said call unit calls;
The service logic that said generation unit is used for resolving according to said resolution unit generates and said functional module corresponding page content.
Above-mentioned system, preferred, also comprise: assembled unit;
Said assembled unit is used for the content of pages that said generation unit generates is made up.
Above-mentioned system, preferred, also comprise judging unit;
Said judging unit is used for before the content of pages that said assembled unit generates said generation unit makes up, judging whether said generation unit accomplishes the generative process to functional module corresponding page content.
Above-mentioned system, preferred, said generation unit comprises:
Interface is set up subelement, content is obtained subelement, related subelement and generated subelement;
Wherein:
Said interface is set up the service logic realization interface that subelement is used to set up said functional module;
Said content is obtained subelement and is used for setting up the content-data that interface that subelement sets up obtains said functional module according to said interface;
The pagefile that said related subelement is used for said content is obtained the said functional module in content-data territory of the functional module that subelement obtains carries out association;
Said generation subelement is used for through said module pagefile said module contents data being generated content of pages.
Technical scheme by above the application embodiment provides is visible; Page module generation method and system provided by the invention; The page is carried out area dividing according to different memory contentss, set up the call relation of each page area and functional module, independently call different functional respectively; Generate said functional module corresponding page content, said content of pages is to generate according to the service logic in the said functional module.In the process of a plurality of page invocation equal modules; Only be provided with in the different page areas and functional module between call relation get final product; Do not need the page code of same reference module just nested to full page, avoided making the degree of coupling of full page increase in the service code with the nested full page of service code of equal modules; If the equal modules content of being quoted in a plurality of pages needs to change, then need be to the problem that part is made amendment of quoting in a plurality of pages.
Embodiment
In order to make those skilled in the art person understand the application's scheme better.To combine the accompanying drawing among the application embodiment below, the technical scheme among the application embodiment is carried out clear, intactly description, obviously, described embodiment only is the application's part embodiment, rather than whole embodiment.Based on the embodiment among the application, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all should belong to the scope of the application's protection.
The process flow diagram of the page module generation method that the application embodiment provides is as shown in Figure 1, comprising:
Step S101: the definition page layout is the page area of a plurality of storage different contents with said page division;
With page division is different page areas, defines the particular content of each page area storage;
Step S102: the call relation of setting up said page area and functional module;
Through setting up the call relation of page area and functional module, make each page area independently to call to functional module;
Step S103: said functional module is called according to said call relation;
Different page areas calls and the corresponding functional module of its content, has realized that the page calls the mode that a plurality of modules generate by zones of different;
Step S104: resolve the service logic in the said functional module of calling, generate and said functional module corresponding page content according to said service logic.
Because module is an independently Service Processing Unit, it has fully independently service code, fully independently page code; And module and homepage have same context relation, so the page and the homepage that are finally generated by module are one.In the page module generation method that the embodiment of the invention provides; Directly module is called; The content of pages that each module is generated merges; Need be in homepage nested module quote code, make that the generation of the page is more direct, avoided various problems because the nested complex operation that brings of code is prone to make mistakes etc.
In the page module generation method that the application embodiment provides; After each page area calling functional modules generates separately the corresponding page content; Also comprise the process that a plurality of different content of pages are made up; Specifically as shown in Figure 3, comprise step S105: the content of pages that the functional module that a plurality of different page areas are called generates makes up.
In conjunction with Fig. 1 and the described embodiment of Fig. 3; In order more clearly to introduce the call relation of page dividing region and page area and functional module; The application's method embodiment provides page area and functional module call relation synoptic diagram, and is as shown in Figure 2, in homepage; Content according to each different page location needs storage; Homepage is divided into a plurality of page areas, and the content of each page area storage is provided with the call relation of page area and the corresponding functional module of its memory contents through definition in advance.
In Fig. 2, regional A respective modules A, when the page generates, regional A calling module A, to the particular content in the modules A, and the realization logic of particular content is resolved generation module A corresponding page content in the modules A; What carry out simultaneously is that each self-corresponding module is called in other zone, generates corresponding content of pages, and each content of pages makes up the most at last, obtains the demand page.
In the page module generative process that the application embodiment provides; Before content of pages makes up; Also comprise the deterministic process that each disparate modules is generated page process; The practical implementation process is as shown in Figure 4, comprising: step S116: judge whether the functional module that a plurality of different page areas call all generates and its corresponding page content; If, execution in step S105; Otherwise, execution in step S117;
Step S117: carry out real-time judge to not accomplishing the module that generates content, all generate and its corresponding page content, finish deterministic process until the functional module of calling; Execution in step S105.
In the description process of above method embodiment; Is an important step according to said service logic generation with said functional module corresponding page content; The method flow diagram according to service logic systematic function module corresponding page content that the application embodiment provides is as shown in Figure 5, comprising:
Step S201: the service logic of setting up said functional module realizes interface;
Service logic in the functional module exists with the form of class group, and the realization of service logic class at first will be set up the pairing interface of logic class;
Step S202: the content-data that obtains said functional module according to said interface;
Realize logic class, obtain content-data, the line correlation business realization of going forward side by side during its main process;
Step S203: carry out related with pagefile in the said functional module content-data of said functional module;
Pagefile in the module is the corresponding static html file of module, and it is related that the pagefile of module and service logic class are carried out, and soon the content-data in the module carries out related with pagefile; Module pagefile can related a plurality of logic class;
Step S104: the content-data of said functional module is generated as content of pages through said pagefile.
It is as shown in Figure 6 that the page that the application embodiment provides and relation between the module are connected synoptic diagram, can be known that by Fig. 6 homepage is through self page logic and pagefile; Generate the layout framework of homepage, the particular content in its framework is generated by the page area calling functional modules; Use same logical relation up and down between homepage and the module; Each module is functional module fully independently, and does not need linking relationship between module and the homepage, does not have corresponding control of authority.
For aforesaid method embodiment; For simple description; So it all is expressed as a series of combination of actions, but those skilled in the art should know that the present invention does not receive 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 the instructions all belongs to preferred embodiment, and related action and module might not be that the present invention is necessary.
To above method embodiment; The application embodiment also provides a kind of page module generation system; Its structural representation is as shown in Figure 7, comprises page definition unit 301, concerns and set up unit 302, call unit 303, resolution unit 304 and generation unit 305;
Wherein:
Page definition unit 301 is used to define page layout, is the page area of a plurality of storage different contents with said page division;
Relation is set up unit 302 and is used to set up the page area of said page definition unit 301 divisions and the call relation of functional module;
Call unit 303 is used for setting up the call relation of setting up unit 302 according to said relation said functional module is called;
Resolution unit 304 is used for resolving the service logic of the functional module that said call unit 303 calls;
Generation unit 305 is used for generating and said functional module corresponding page content according to the service logic that said resolution unit 304 is resolved.
On the basis of system shown in Figure 7, the application embodiment also provides a detailed structure synoptic diagram of page module generation system as shown in Figure 8, also comprises: assembled unit 306;
Assembled unit 306 is used for the content of pages that said generation unit 305 generates is made up.
On the basis of system shown in Figure 8, the application embodiment provides the another detailed structure synoptic diagram of page module generation system as shown in Figure 9, also comprises judging unit 307;
Judging unit 307 is used for before the content of pages that 306 pairs of said generation units 305 of said assembled unit generate makes up, judging the generative process whether said generation unit 305 is accomplished functional module corresponding page content.
Figure 10 provides the detailed structure synoptic diagram of generation unit among the application embodiment; Generation unit 305 comprises:
Interface is set up subelement 401, content is obtained subelement 402, related subelement 403 and generated subelement 404;
Wherein:
Interface is set up the service logic realization interface that subelement 401 is used to set up said functional module;
Content is obtained subelement 402 and is used for setting up the content-data that interface that subelement 401 sets up obtains said functional module according to said interface;
The pagefile that related subelement 403 is used for said content is obtained the said functional module in content-data territory of the functional module that subelement 402 obtains carries out association;
Generating subelement 404 is used for through said module pagefile said module contents data being generated content of pages.
For system embodiment, because it is basically corresponding to method embodiment, so description is fairly simple, relevant part gets final product referring to the part explanation of method embodiment.
Method embodiment and system embodiment that cumulated volume application embodiment provides; Among the present invention; With the page area of page division for the storage different content, call the functional module that is under the complete separate state through page area, only realize generative process to the page through calling module; Avoided in the service code with the nested full page of service code of equal modules; Make the degree of coupling of full page increase; If the equal modules content of being quoted in a plurality of pages needs to change, then need be to the problem that part is made amendment of quoting in a plurality of pages.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, and identical similar part is mutually referring to getting final product between each embodiment, and each embodiment stresses all is the difference with other embodiment.The above only is the application's a embodiment; Should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the application's principle; Can also make some improvement and retouching, these improvement and retouching also should be regarded as the application's protection domain.