Recently, ESET add my domain name to the black-list of their database. You can’t open my site and been warned my site is not safe if your PC is running the ESS or EAV. Why Eset block my site?The answer is obvious. That is reason that you come here. I promise that my site is pure, no virus, no spyware, no Trojan, no pop ads. You can test my word through intalling Kaspersky or other Antivirus Software. If you want open my site and take latest escalation ID & Activation Code, close your ESET software(disable antivirus and antispyware protection function temporarily) or by proxy or virtual machinor. You can also feed the RSS source http://feed.loserblog.cn.
Home > Programm > struts1 and compare struts2

struts1 and compare struts2


Li Gang, the last to see that this part of the struts2, feeling that the upgraded version of webwork, compared with struts1 still great differences. The combination of the Internet some of the information I had to sum up slightly struts1 and struts2 the difference between:
Class Action
Struts1 the action necessary to inherit an abstract base class. Struts1 is a common problem is an abstract category for programming to replace the programming interface.
Struts2 of action can achieve an Action interface, can also achieve some other interface to acquire some additional, commonly used services. Struts2 to provide a base class ActionSupport achieve some common interface. Although the Action interface is not necessary. Any way attached to execute the POJO objects can be as Struts2 of action targets.

Servlet dependence
Struts1 dependent on the Action Servlet API, Action is called for when the time HttpServletRequest and execute HttpServletResponse object through the method of processing.
Struts2 of Action on almost does not directly dependent on the Servlet API. Servlet context was often portrayed as a simple Map mapping, Action was allowed a separate test. Of course, if need be Struts2 of Action can also visit the initial request and response to the completion of some functions. However, some other structure elements lead to lower or remove a direct response to the request and demand.

Easy test of
Struts1 test of Action is a major obstacle to execute is directly exposed to the servlet API.
Struts2 of Action can easily attribute the call by setting up methods for testing. Of course, rely on the support of injection also makes testing simple.

Enter treatment
Struts1 ActionForm object to the use of an access to user input. And action, all the ActionForm must be inherited from a base class. Because the other can not be used as the javaBean ActionForm, developers usually write some extra class to obtain user input. DynaBean can be used to generate ActionForm kind of a choice, but developers need to rewrite the existing javaBean.
Struts2 use of Action attributes as input attributes, get rid of the demand for the importation of objects. Enter attribute can be an owner of his own attributes of objects. Action by tags and attributes are interactive web pages. Struts2 also support ActionForm model, is the Form POJO objects and POJO of Action. Most of the type of person, including targets and areas of business logic object can be used as input / output targets. Models Driver features simplified labels and POJO enter the relationship between objects.

Expression language
Struts1 and JSTL integration, so he can use JSTL the EL.
Struts2 also support JSTL, but this framework also supports a stronger e­xpression of language OGNL.

The type of performance and value of bundled
Struts1 using standard JSP mechanism would bind to the target page context to his visit.
Struts2 use "ValueStack" technology, so do not have to label the view of the target and performance can get value. ValueStack policy allows through a series of attributes may have the same name
But the word different types of properties to complete view of the type of reuse.

Type -
Struts1 the ActionForm are usually String type. Struts1 through the Commons-Beanutils achieve conversion.
Struts2 use OGNL achieve conversion, the framework includes the foundation and public types of converters.

Authentication
Struts1 support ActionForm validate method of manual verification. You can also verify the extension of universal framework for validation. For the same category can have a different verification, but not linked to the object of verification.
Struts2 also supported by validate methods for manual verification and validation Xwork framework for validation. Xwork certification framework will support the verification link to sub-attributes, sub-attributes to the use of the property type and verify the context of the definition of certification.

The implementation of the Action Control
Struts1 support for each module allocation request processing (life cycle), but a module of Action must all share the same life cycle.
Struts2 support the passage of the interceptor stack for each Action create a different life-cycle. Action is usually based on the different needs of the corresponding stack must have been created and used.

Categories: Programm Tags:
  1. No comments yet.
  1. No trackbacks yet.
  • Partner links