Struts2 review lesson 1 --- environment setup

Source: Internet
Author: User
Struts2 developed based on webwork2 and belongs to MVC framework 1. advantages of struts2: 1. in software design, struts2 is not closely coupled with servletapi and strutsapi as in struts1. The application of struts2 can be independent of servletapi and strutsapi. struts2 is a non-intrusive design, while struts1 is an intrusive design. 2. struts2 provides an interceptor that can be used for AOP programming, implement functions such as permission interception 3. struts2 provides a type converter that converts special request parameters to the required type. In struts1, to implement the same function, you must register the type converter with beanutil at the bottom layer of struts1. 4. struts2 provides multiple presentation layer technologies, such as JSP, freemarker, velocity, etc. 5. struts2 input validation can be performed on the specified method, solving the long-term pain of struts1 6. Providing a global range,, 2.16 Versions later must be added to this file commons-io-2.0.1.jarcommons-lang-2.5.jarcommons-logging.jar struts2 framework using this log to support log4j and JDK logging freemarker-2.3.18.jar struts2 is the template of the UI tag, making Use freemarker to write the javassist-3.12.0.GA.jarognl-3.0.4.jar struts2 framework through its Read and Write object properties struts2-core-2.3.1.2.jar struts2 framework core class library xwork-core-2.3.1.2.jar struts2 built on it 2. Write struts2 configuration file struts2 default configuration file is struts. XML, the file needs to be stored in the WEB-INF/classes, in the process of project, put in SRC can be <! Doctype struts public "-// Apache Software Foundation // DTD struts configuration 2.3 // en" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> </struts> 3. add struts2 MVC Framework STARTUP configuration to XML <filter> <filter-Name> struts2 </filter-Name> <filter-class> Org. apache. struts2.dispatcher. ng. filter. strutsprepareandexecutefilter </filter-class> </filter> <filter-mapping> <filter-Name> struts2 </filter-Name> <URL-pattern>/* </url-Pattern> </filter-mapping> note: struts2 reads struts. the XML content is stored in the memory in the form of JavaBean. In the future, struts2 will use the data in the memory for each request processing, instead of reading struts every time. XML file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.