Abstract The technical architecture of the presentation layer framework. It can be said that all the presentation layer framework technologies must implement the function architecture:
Based on the MVC model, a presentation layer framework needs to implement three functions in the diagram:
1. The content of a component object can be displayed on the current page. Instead of writing the Java code "Call object method" on the JSP page just like JSP.
2. When the user presses the page to submit a button or link, the event occurs. In this case, the server side should be triggered and the parameters of the current page should be submitted to the server. This mechanism is manifested in Form submission and parameter Links <a href = ""> </a>
3. directly jump from a page view to another page view for simple navigation.
We use the table below to compare the technical details of these three frameworks when implementing each function, so as to draw out their similarities and differences and their key points.
|
Struts |
Tapestry3.0 |
JSF |
Component requirements displayed in view |
The component must inherit the actionform |
Explicit and implicit calls The component must inherit the basecomponent |
Common pojo No inheritance required Managed Bean |
Display granularity of Components in view |
The view page can only display the actionform corresponding to the form. In the configuration, the action actionform page can only be. |
You can embed a component into any row of the page, with no limit on the number of components used. |
Same as tapestry |
Page partition tiles |
Using tiles label library implementation requires additional tiles-def.xml configuration files |
A widget has its own view page. by calling a widget, you can directly combine multiple pages. Strong natural page combination is its characteristic. |
Subview is implemented through the component + tag library, but if layout needs to be reused, it must be combined with tiles. |
Page Jump |
Use the tag library HTML: Link to specify the target URL. The URL name must be named against the path in the configuration file, coupled with the component action. |
The URL name is the name of the target component, which does not involve URL or path operations. |
Similar to struts, you also need to find it in the configuration file and separate it from the component. |
Parameter transfer |
When using HTML: link, it is troublesome to pass more than one parameter. |
Directly call the component and assign parameters directly. There is no limit on the number of parameters. |
Pass Parameter separation to component |
Event triggering |
Submit is submitted through the form for activation. Fields in the form cannot be refined. |
An event can be attached to each field in the form. The event component must implement the pagelistener interface. |
Same as tapestry, the event component must practice the actionlistener Interface |
|
Choosing tapestry has the following advantages:
1. the most thorough MVC development framework. The page code is composed of HTML standard tags. The page artist does not need to understand the special tag definition.
2. Reusable Component development saves development resources. One sentence: the easier it is to develop
3. Excellent page transfer development. In the traditional method, activation page flow is implemented based on URLs. In addition to this method, you can also implement page flow like developing common Java classes.
It is important that page classes can also be reused.
4. Rich component resources. In addition to officially maintained resources, you can also find a large number of tapestry component libraries.
5. Strong scalability. Tapestry is a real open architecture. To put it bluntly, you can replace it with something you think is uncomfortable.
6. strong vitality and constant self-updating and development. Compared with 3.0, tapestry4.0 is just another leap. For example, it supports the annotations of jdk1.5. Currently, only this open-source product
Only see one hibernate; Support the Portlet JSR-168, and one conforms to the trend of web development support. In the plan, 4.1 will support static pages, which is not exactly the work of many developers.
Another expectation?
7. Stable tapestry developers. A group of people are developing and supporting the tapestry process.
8. Is tapestry mature? There are already a lot of software and big websites based on tapestry,
Foreign: software such as Seaview content management system, widentm digital asset management system
Large websites such as: http://www.nhl.com/, http://www.theserverside.com/, https://merchant.shopping.com/enroll/app, http://www.identitytheft911.com/home.htm, http://admissions.chicagogsb.edu/admissions/app
Domestic: software such as http://www.onetsoft.com, such as: http://love.9618.com.cn/dating/app, http://dbi.lib.ntu.edu.tw/libraryList/, http://www.cdcin.com/, http://www.xtcin.com/, http://www.xnjs.com/
Struts component model disadvantages
Struts component programming must be limited to the action, actionform, and JSP boxes, which are relatively difficult, while tapestry and JSF do not have many technical boxes, the two allow programmers more freedom and convenience in component programming. This is also the advantage of component framework.
Overview
JSF is similar to struts to a large extent, rather than like tapestry. It can be said that it is a type of struts 2.0, all in the form of tag library + component, however, the concept of JSF components does not have to inherit the actionform restrictions as struts does; JSF must be fine-grained in terms of event granularity. Unlike struts, a form is an event, JSF can be refined to every field in the form.
JSF is similar to tapestry only in terms of component and event mechanisms, but is not like Tapestry as a complete component framework. Therefore, if you want to build a system with high page flexibility, choosing tapestry is the first consideration.
Struts/JSF is suitable for general data page entry systems. For selection of struts and JSF, my personal opinion is: if you are a new system, you can start with JSF directly. If you have used struts, you do not need to convert it. If you need to switch, you can consider JSF and Tapestry together.
In addition, JSF/tapestry not only supports HTML, but also supports multiple client languages such as WML or xui.
Relationship between the three:If struts is left, tapestry is right, while JSF is middle.Moderate doctrine is the consistent strategy of the Sun Alliance.