1. Set up the Struts2 environment and struts2 Environment
In the past few days, I suddenly heard from the leaders about the SSH framework project. net mvc, a little chicken, the good news is that there will be a period of learning time, in order to speed up, can only look at Struts2, just try to do the project as soon as possible.
Environment: IDE: Eclipse Java ee ide for Web Developers. The Tomcat7 plug-in has been installed.
Struts version: 2.3.24.1
The most basic packages required by Structs2 are:
:
At the beginning of the package does not reference the commons-lang3-3.1.jar package, only use the struts-2.3.24.1 extract a few of the required packages, but in the execution process will report the error:
I just need to add this package. I still don't know why. Can someone tell me why?
========================================================== ========================================================== ==================
Struts2 Environment Construction
1. Create a new "Dynamic Web Project" Project. Remember to check the file on the Next page.
2. Under the WebContent-WEB-INF-LIB directory, reference the above mentioned several Struts2 required packages.
3. edit web. xml. This is to check the created configuration file when creating a project to configure the core Filterl of Struts2.
1 <? Xml version = "1.0" encoding = "UTF-8"?> 2 <web-app xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns = "http://java.sun.com/xml/ns/javaee" xmlns: web = "http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi: schemaLocation = "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id = "WebApp_ID" version = "3.0"> 3 <display-name> Structs2Demo </display-name> 4 <! -- Define core Filter --> 5 <filter> 6 <filter-name> struts2 </filter-name> 9 <filter-class> 10 org. apache. struts2.dispatcher. ng. filter. strutsPrepareAndExecuteFilter11 </filter-class> 12 </filter> 13 <! -- Filter interception rules: /* indicates that all requests are intercepted --> 14 <filter-mapping> 15 <filter-name> struts217 </filter-name> 18 <url-pattern>/* </url-pattern> 20 </filter-mapping> 21 </web-app>
Note: Before struts-2.1.3, <filter> <filter-class> under the node should use "org. apache. struts2.dispatcher. FilterDispatcher"
In this way, the Struts environment has been set up!