Business assembling and Page Template based on MVC melt the method for sending out the WEB platform
One, technical field
The present invention relates to the Application development environ-ment of WEB platform, especially business assembling and the Page Template based on MVC melts the method for sending out the WEB platform.
Two, background technology
Along with the continuous rise of Internet technology, perfect, the trend that the current information system builds is to adopt the B/S structure to substitute the C/S structure.The user job interface is to realize by the WWW browser, and few part affairs logic realizes at front end (Browser), but main affairs logic forms so-called three layers of 3-tier structure in server end (Server) realization.So just simplify client load greatly, alleviated the cost and the workload of system maintenance and upgrading, reduced user's overall cost (TCO).
Internet technology and related specifications numerous and complicated, this just caused the B/S structure project often occur delaying, be not easy control, nonstandard phenomenon.Such as DHTML, XML, CSS, JavaScipt isotactic model body is just very mixed and disorderly, and the relatively unusual bottom of J2EE Servlet standard lacks one efficiently, possess abstract accumulation and extendible platform, various WEB development schemes are full of in the current WEB system.
Project based on the B/S structure, traditional relatively C/S structure, because the affairs logical centralization is realized at server end, though simplified the load of client, but also increased the weight of the load of server end simultaneously, project based on the B/S structure is needing level framework more clearly aspect the system architecture like this, has so just emerged in large numbers a large amount of based on the MVC pattern framework of increasing income.C/S (Client/Server) structure, i.e. everybody client-server structure of knowing.It is a software system architecture, can make full use of the advantage of two ends hardware environment by it, and the task reasonable distribution is brought in realization to Client end and Server, has reduced the communication-cost of system.Present most of application software system all is the double-layer structure of Client/Server form, because present software application system is to distributed Web application development, Web and Client/Server use can carry out same business processing, uses different module shared logic assemblies; Therefore, the inner user with the outside can visit new and existing application system, can expand the application system that makes new advances by the logic in the existing application system.This is the developing direction of present application system just.
Though what traditional C/S architecture adopted is open mode, this is the opening of system development one-level, is that Client end or Server end all also need specific software support in specific application.The user is provided owing to fail the open environment of real expectation, the software of C/S structure need be at the software of different operating system system development different editions, the update of product is very fast in addition, has been difficult to adapt to hundred above LAN subscriber of computer and has used simultaneously.And the cost height, efficient is low.
B/S (Browser/Server) structure is browser and server architecture.It is the rise along with the Internet technology, to a kind of variation or the improved structure of C/S structure.Under this structure, the user job interface is to realize by the WWW browser, and few part affairs logic realizes at front end (Browser), but main affairs logic forms so-called three layers of 3-tier structure in server end (Server) realization.So just simplify client computer load greatly, alleviated the cost and the workload of system maintenance and upgrading, reduced user's overall cost (TCO).
See that with present technology LAN (Local Area Network) is set up the network application of B/S structure, and by database application under the Internet/Intranet pattern, be easy to relatively hold, cost also is lower.It is the disposable exploitation that puts in place, can realize different personnel, and from different places, (such as LAN, WAN, Internet/Intranet etc.) visits and operate common database with different access waies; It is protected data platform and management access authority effectively, and server database is also very safe.Particularly after the so cross-platform language of JAVA occurred, B/S framework management software was convenient, fast especially, efficient.
MVC under the MVC pattern (Model-View-Controller) application structure is used to the feature of analysis distribution formula application program.This abstract structure can help application program is divided into some logical blocks, program design is become to be more prone to, though separator page represents and service logic fully, but webpage representation needs the developer to understand enough DHTML, CSS, JavaScript knowledge, and need certain being familiar be arranged to INTERFACE DESIGN such as page composings.
In this case,, simpler on traditional C/S pattern than B/S mode development based on visual development scheme, be easier to left-hand seat.Need like this based on assembly, based on the framework of the MVC pattern of template development mode, not only can meet large-scale commerce on the framework level uses, and in the exploitation of project and safeguard can be based on assembly, template and unified encapsulation, simplify exploitation to greatest extent, improve development efficiency, to be more conducive to the commercialization that project is used like this, and be more conducive to the division of labor of development teams and improve development efficiency.
But, on the framework that provides based on the mode of increasing income, it is too wide to need the developer to understand the scope of one's knowledge of study, too in complexity, and it is too frequent to upgrade upgrading, causes the developer to be difficult to catch up with new technology fully, and can not be suitable fully based on the existing framework of the application of enterprise, like this intra-company is essential can the unitized overall development platform, improve company's market influence and competitive power.
Three, summary of the invention
The present invention seeks to propose a kind of business assembling and Page Template and melt the method for sending out the WEB platform based on MVC.
Technical solution of the present invention is: business assembling and Page Template based on MVC melt the method for sending out WEB, based on the MVC Design Mode, the M layer realizes that by JavaBean, EJB, Tuxdeo the V layer is realized by HTML, the C layer is realized by classes of pages, the page can be separated fully with logic like this;
Page Templateization, express logic based on HTML extending marking and extended attribute, only need to add that in HTML mark can give expression to the dynamic page effect, make things convenient for art designing and programmer to share page development, the art designing stresses page effect, and the programmer stresses page logic.
Based on modularity: can other assemblies of nested use in the component template, nested except that the core component storehouse, other assembly need define in Component Gallery;
Assembly belongs to the part of Page Template, generating portion HTML code when operation;
All properties in the assembly all provides in component profile, and the attribute that does not provide for component profile can use as the attribute of html;
Modular construction and formation
Assembly can be regarded an atomic element that can be re-used in fact as, and from the UI interface, it can be summed up as public part zone, selects assembly as the employee; From service logic, it has encapsulated one section unified service logic, as department organization structure tree.
An assembly physically, its file form with a page be duplicate, html masterplate (be not complete, but part); The xml configuration; The java code
The exploitation of single type components class
Component class is write public abstract class SimpleField extends AppFormComponent{
public?abstract?String?getValue();
protected?void?renderComponent(IMarkupWriter?writer,IRequestCycle?cycle){
IForm?form=getForm(cycle);
String name=form.getElementId (this); // securing component title
If (! Cycle.isRewinding ()) // whether recoil, if recoil then do not construct the page
Body?body=Body.get(cycle);
if(body==null){
throw?new?ApplicationRuntimeException(Tapestry.format(
"must-be-contained-by-body","SimpleField"));
}
String?value=getValue();
writer.beginEmpty("input");
writer.attribute("type","text");
writer.attribute("name",name);
writer.attribute(“value",value);
RenderInformalParameters (writer, cycle); // for undefined other attributes in the assembly of quoting also output again, class=..., all information of filling in the time of can guaranteeing references component like this can both be preserved former state;
1) references component in the page:<input type=" text " jwcid=“ @xxx:SimpleField " value=" ognl:info.VALUE " class=" ... " /
2) common method writer.begin (" select "), writer.end () must finish with end for begin; Writer.beginEmpty (" input ") does not need end to finish for this mode, writer.print (" ... ") can arbitrarily write content
Arrangement of components
1, component registration (.library) in Component Gallery:
<library-specification>
<component-type?type="Login"specification-path="login/Login.jwc"/>
<library?id="contrib"
specification-path="/org/apache/tapestry/contrib/Contrib.library"/>
</library-specification>
The component registration storehouse is (.application) in global configuration:
<library?id=“quickstart"
specification-path="/com/linkage/quickstart/jwcs/quickstart.library"/>
1, assembly uses in Page Template, and by the attribute of component definition, assembly is used in configuration flexibly
2, list-type assembly uses:
<input?type=”text”jwcid=”BEGIN_DATE@wade:TextField”
value=”ognl:info.BEGIN_DATE”format=”yyyy-MM-dd?HH:mm”/>
3, combined assembly uses:
<span?jwcid=”@wade:NavBar”source=”ognl:infos”
listeners=”ognl:listeners.querySchedules”/>
The present invention utilizes the MVC pattern that displaying interface and service logic are separated fully, such application is divided into model layer, view layer, key-course, the model layer logic of managing business wherein, the view layer represents interfacial effect, and key-course is used for being connected webpage representation and service logic.
On above-mentioned basis, separator page represents and service logic fully on the program application architecture, can separate art designing and programmer fully simultaneously, and the art designing is absorbed in Interface Design such as page composing layout, and the programmer can be absorbed in the logic Modification of program, is independent of each other between the two.
The WEB platform WADE that the present invention produces, be take out in the Portal Service on BOSS1.5 and the telecommunications network, based on the business development and the running environment of assembly, itself also is the infrastructure component platform of an application simultaneously.Its purpose is to upper strata application system shielding underlying platform and ins and outs on the one hand, and relevant instrument is provided, so that the application developer can pay close attention to the business field more; WADE also provides the environment of a professional flexibly assembling and operation on the other hand, is " modularization " of the upper-layer service system condition that provides the foundation, and based on the infrastructure component platform stable operation of WADE.
WADE goes for professional enterprises operation system, also goes for the outside gate system of enterprise.As the basic WEB platform of telecommunications industry application software, have foreseeable, more permanent influence and competitive power at present.
On the one hand, it realizes the major technique of telecommunications industry WEB system at present, verified exploitation high efficiency, stability, the extensibility of this platform environment in implementing BSS system of a new generation of mobile BOSS1.5 and UNICOM, in the process of implementing BOSS2, BOSS2 commmunication company enterprise portal, more can strengthen client's degree of belief simultaneously, create the more products sales opportunnities; On the other hand, as the basic platform that has adopted current advanced WEB advanced technology thought; The target customer of application of the present invention and range of application:
The research and development target of WADE1.0 is the basis operation and Development Framework (or assembly) for the WEB platform of telecommunications industry business support system, though it does not directly sell the directly development and application of multiplexing this assembly of range of application at present towards the final user.Along with the development of following WADE and to the extension of service layer, can form external member on its basis gradually towards a plurality of applications, as by Eclipse RCP mode, can provide the RapidIDE instrument of specialty to the client.Can the crm system of framework on the WADE framework be refined into the CRM product by integrating the technology of SOA and BPM, push more areas to.As by after promoting WADE, assembly itself also can be formed a market, encourage more people to participate in the assembly exploitation.
Effect of the present invention: WADE mainly contains on the WEB development approach and has adopted masterplateization, com technique, thereby has guaranteed maximum dirigibility and extensibility.In actual application, carried out the optimization component design at many aspects such as buffer memory, file processing, graphics process, to have passed through high real system concurrent, big data quantity and checked, it has the special advantages of oneself at undertaking of construction WEB system aspects:
1) WEB technology itself is maked rapid progress, design of WADE core frame platform self and ins and outs possess separation layer, can introduce up-to-date technology fast;
2) on the basic platform component platform is arranged, but this component platform itself possesses the characteristic of suit, distribution
3) based on the technology of masterplate, the mutual design of UI is thoroughly spun off, can really the User Interface design be gone on.
4) with respect to the existing MVC framework of increasing income, key property comprises:
√ has inherited some advantages of the framework of increasing income, as Page Template, based on modularization etc., provides unified encapsulation to assembly and service logic commonly used simultaneously, has at utmost simplified complexity of developing, guarantees the consistance of exploitation.
√ is based on the MVC Design Mode, and the M layer realizes that by JavaBean, EJB, Tuxdeo the V layer is realized that by HTML the C layer is realized by classes of pages, the page can be separated fully with logic like this.
The √ Page Templateization, express logic based on HTML extending marking and extended attribute, only need to add that in HTML mark can give expression to the dynamic page effect, make things convenient for art designing and programmer to share page development, the art designing stresses page effect, and the programmer stresses page logic.
√ can simplify page development based on modularity, reuses assembly, improves the consistance that development efficiency also can keep program to greatest extent.
The √ page cache, the page is resolved needs resource, can improve operational efficiency greatly behind the buffer memory page.
The issued transaction that √ is unified, unified connection management, unified abnormality processing, these are sightless for the developer, can guarantee the stability of system to greatest extent.
The client verification that √ is unified, unified page navigating mode, can be between multisystem redirect mutually, making can seamless connection between each system.
√ is based on the mechanism of the asynchronous submission of Ajax, and the page is refreshed in the realization part, for the user provides more friendly interface, and can improve developer's development efficiency.
√ provides the interface of using based on EJB, can easily provide interface for other system.
5) in the long run; WADE has then brought communication to wait the opportunity of industrial application software commercialization; and provide visible, effective path; this is for the scale effect that promotes the applicant or other software company's software operation; further participate in international market competition, the influence that promotes in industry all has great importance.
Four, description of drawings
Fig. 1 is the WEB platform structure block diagram that the inventive method constitutes
Fig. 2 is that the WADE envelope has been changeed a large amount of infrastructure components, the structural drawing of Service Component
Five, embodiment
WADE is made up of with relevant integration tool the assembly of one group of high degree of autonomy among Fig. 1, has good reusability, and general structure is as figure;
WADE itself also seals infrastructure component, the Service Component that has changeed a large amount of, and Fig. 2 is as follows for its modular construction:
The exploitation of page module function point:
1, WADE uses operational scheme:
1) starts application server, load the WEB that disposes and use
2) WEB use to seek deployment descriptor (web.xml), as the inlet of program run, and loads some configurations of servlet, filter, monitor, session
3) client submits to access path to initiate request to server end, and server end searches out the Servlet of client-access in web.xml, owing to disposed filter, the root path of visit can navigate among the app Servlet of configuration
4) find .application configuration file of the same name by the title that disposes among the app Servlet, as quickstart.application
5) dispose among the loading .application, comprise some configurations of Engine, Visit, Page
6) submit to the page of visit to call according to client, in the .application file, find the corresponding page file of page another name of registration
7) find corresponding java by the page file, the html file reaches and seeks the resource purpose
2, the concrete steps of function point exploitation
1) prepare the resource that development function point needs, comprise Page Template (.html), page standard (.page), classes of pages (.java), and concrete service logic.
2) registering functional point is registered to the page standard of finishing writing among the .application in the .application file, and defines unique name.
3) configuration testing menu newly adds the menu code in Siderbar.html, as:
redirectToNav(‘util.SchedultList’,‘querySchedules’);
4) click the menu debugged program.
3, page standard is write
1), page standard is as the hinge that is connected Page Template and classes of pages, needs the path of definition classes of pages, Page Template, needs to define used all objects of Page Template simultaneously, as:
The path of<-definition classes of pages-
<page-specification?class="com.linkage.quickstart.view.util.ScheduleList">
The object name that<-definition Page Template need be used and the structure of object-
<property-specification?name="condition"
type="com.linkage.appframework.data.IData"/>
</page-specification>
2), supplementary notes:
(1) can define the path of classes of pages in the page standard, the mapping ruler of page standard corresponding page template exactly by page authority file with the .html file of (not containing extended file name) of same filename under the catalogue
(2) page standards must a corresponding Page Template and a classes of pages
(3) Page Templates must corresponding page standards, and classes of pages can corresponding a plurality of page standards, that is to say that a plurality of Page Templates can a shared classes of pages
4, classes of pages is write
1), classes of pages is as the key-course among the MVC, mainly is the hinge that is used for being connected between the service logic and the page, and service logic is submitted in the request of the page, gives the page by feedback result after the business logic processing.
The result object that classes of pages is mainly write the incident of response page and fed back to the page, as:
public?abstract?class?ScheduleList?extends?AppPage{
Need in/* definition the Page Template object * that uses/
public?abstract?void?setInfos(IDataset?infos);
public?void?querySchedules(IRequestCycle?cycle)throws?Exception{
/ * structure page context object */
PageData?pd=getPageData();
IDataset infos=... (data of obtaining by logic);
/ * with the data assignment obtained give this object for Page Template use */
setInfos(infos);
2), supplementary notes:
(1) classes of pages must be inherited AppPage or its subclass, otherwise can't form a function with Page Template, page standard;
(2) abstract method is used in the attribution method suggestion that offers the Page Template use of definition, otherwise must if do not empty, can cause entanglement with object clear sky when the page is finished, and note: the abstract method of definition must define in page standard;
(3) Ding Yi response events must have parameter I RequestCycle cycle, otherwise can't discern the response events that this method is based on the page in the page;
(4) PageData is as page context object, can obtain in the page of submitting server to all objects and can transmit parameter to one page down;
5, Page Template is write
1), Page Template mainly be the data exhibiting that will obtain in the service logic in the page, and to some controls of page operation, the Page Template structure is as follows:
<html?xmlns="http://www.w3.org/1999/xhtml">
<head?jwcid="@wade:Head">
<meta?http-equiv="Content-Type"content="text/html;charset=gbk"/>
<title>Schedule?List</title>
<link?href="/component/styles/styles_all.css"rel="stylesheet"type="text/css"media="screen"/>
</head>
<body?jwcid="@Body">
<formjwcid="@Form">
2), supplementary notes:
1) represents dynamic content, the related resource and the explanation of head representation page template, the content of body representation page template for displaying with jwcid sign in the template in the page;
2) wherein the Head assembly mainly is to import some public resources, and as the JavaScript storehouse, the Body assembly is the support of assembly container for most of assembly, and the Form assembly is being submitted server to the post mode;
3) the ognl mark is represented to come dynamic expression content with the Java expression formula;
The exploitation of assembly
The concrete steps of assembly exploitation
1) prepares the resource that assembly needs, comprise component template (.html), component specifications (.jwc), component class (.java).
2) write assembly, need write component template, then do not need for the unicity assembly for combined assembly.
3) assembly that writes of registration is registered to the component specifications of finishing writing among the .library in the .library file, and defines unique assembly name in Component Gallery.
4) component registration storehouse, in the .application file with the Component Gallery file registration finished writing in .application, and define unique Component Gallery name.
5) debug component.
Assembly exploitation classification
The assembly exploitation is divided into two kinds:
1), the single type assembly, generally the assembly based on minimum particle size uses the single type assembly, the HTML code of the assembly of the type is write in component class, so assembly only comprises component class, component specifications.
2), combined assembly, generally use combined assembly based on a page area, the HTML code of the assembly of the type realizes in component template, so assembly comprises component template, component class, component specifications.
Component specifications is write
1), component specifications is as the hinge that is connected component template and component class, needs the path of definitions component class, component template, needs used all objects of definitions component template simultaneously, as:
<component-specification?class="com.linkage.quickstart.jwcs.login.Login"allow-body="no"allow-informal-parameters="no">
<description>login.</description>
<parameter?name="listener"type="org.apache.tapestry.IActionListener"required="yes"/>
<component?id="bsubmit"type="Submit">
<inherited-binding?name="listener"parameter-name="listener"/>
</component>
</component-specification>
2), supplementary notes:
(1) path that can the definitions component class in the component specifications, the mapping ruler of the component template of component specifications correspondence exactly by the component specifications file with the .html file of (not containing extended file name) of same filename under the catalogue.
(2) all properties that defines in the assembly can be developed to the user, like this during references component arbitrarily the attribute of definitions component reach the effect of dynamic use assembly.
Component class is write (combined assembly)
1, component class mainly is the hinge that is used for being connected between service logic and the assembly, and the result after handling is fed back to assembly.
2, component class is mainly write the dynamic data that component template need be used, as:
public?abstract?class?Login?extends?AppTempletComponent{
protected?void?renderComponent(IMarkupWriter?writer,IRequestCycle?cycle){
super.renderComponent(writer,cycle);
3, supplementary notes:
1) component class must be inherited BaseComponent or its subclass, otherwise can't form a function with component template, component specifications.
2) component class must be realized the renderComponent method, and this method is used for representing the effect in the component template.
Component template is write (combined assembly)
1, component template mainly be the data exhibiting that will obtain in the service logic in the page, the component template structure is as follows:
<div?class="login">
<table?width="100%"border="0"cellspacing="0"cellpadding="0">
<tr>
<td class=" mylf "〉user name:</td 〉
<td?class="myrt"><label>
<input type=" text " name=" STAFF_ID " desc=" user name " nullable=" no " equsize=" 8 " datatype=" text " onfocus=" select (); "/〉
2, supplementary notes:
Can other assemblies of nested use in the component template, nested except that the core component storehouse, other assembly need define in Component Gallery
Component class exploitation (single type assembly)
1, component class is mainly write, as:
public?abstract?class?SimpleField?extends?AppFormComponent{
public?abstract?String?getValue();
protected?void?renderComponent(IMarkupWriter?writer,IRequestCycle?cycle){
IForm?form=getForm(cycle);
String name=form.getElementId (this); // securing component title
If (! Cycle.isRewinding ()) // whether recoil, if recoil then do not construct the page
Body?body=Body.get(cycle);
RenderInformalParameters (writer, cycle); // for undefined other attributes in the assembly of quoting also output again, as class=..., all information of filling in the time of can guaranteeing references component like this can both be preserved former state;
2, supplementary notes:
Such as references component in the page:<input type=" text " jwcid=“ @xxx:SimpleField " value=" ognl:info.VALUE " class=" ... " /
Common method writer.begin (" select "), writer.end () must finish with end for begin; Writer.beginEmpty (" input ") does not need end to finish for this mode, writer.print (" ... ") can arbitrarily write content
Arrangement of components
1, component registration (.library) in Component Gallery, as:
<library-specification>
<component-type?type="Login"specification-path="login/Login.jwc"/>
<library?id="contrib"
specification-path="/org/apache/tapestry/contrib/Contrib.library"/>
</library-specification>
2, component registration storehouse (.application) in global configuration, as:
<library?id=“quickstart"
specification-path="/com/linkage/quickstart/jwcs/quickstart.library"/>
1, assembly uses in Page Template, and by the attribute of component definition, assembly is used in configuration flexibly
2, the single type assembly uses, as:
<input?type=”text”jwcid=”BEGIN_DATE@wade:TextField”
value=”ognl:info.BEGIN_DATE”format=”yyyy-MM-dd?HH:mm”/>
3, combined assembly uses, as:
<span?jwcid=”@wade:NavBar”source=”ognl:infos”
listeners=”ognl:listeners.querySchedules”/>
4, supplementary notes:
1) assembly belongs to the part of Page Template, generating portion HTML code when operation
2) all properties in the assembly all provides in component profile, and the attribute that does not provide for component profile can use as the attribute of html.