In accordance with the process:
A, struts2 built environment
1, download struts2
Somehow difficult to download in https://struts.apache.org/download.cgi#struts2522 website, and ultimately to find a Web site to download the other blog struts2.3.16.1 version,
2, the jar package into the lib directory under WEB-INF.
3, the filter core disposed struts
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" 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>mobile_scm</display-name> 4 <welcome-file-list> 5 <welcome-file>index.jsp</welcome-file> 6 </welcome-file-list> 7 <filter> 8 <filter-name>Struts2</filter-name> 9 <filter-class> 10 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter 11 </filter-class> 12 </filter> 13 <filter-mapping> 14 <filter-name>Struts2</filter-name> 15 <url-pattern>/*</url-pattern> 16 </filter-mapping> 17 </web-app>
4, configuration struts.xml
. 1 <? XML Version = "1.0" encoding = "UTF-. 8" ?> 2 ! < DOCTYPE Struts the PUBLIC . 3 "- the Apache Software Foundation // // 2.3 // EN the DTD the Struts the Configuration" . 4 "HTTP: // Struts. apache.org/dtds/struts-2.3.dtd " > . 5 . 6 < Struts > . 7 <-! define what form of extension is performed, not configured to perform places form .action -> 8 <! - <Constant name = "struts.action.extension" value = "do" /> -> . 9 <-! whether the development model, the deployment is set to false -> 10 <constant name="struts.devMode" value="true" /> . 11 < Constant name = "struts.enable.DynamicMethodInvocation" value = "to false" /> 12 is <-! Package: Package 13 is namespace attribute: all action is provided for the current path of a global packet 14 Package of name: is a name only, no specific meaning 15 -> 16 < Package name = "default" namespace = "/" the extends = "Struts-default" > . 17 <-! action tag: to create an action class 18 is name attribute : virtual path 19 class: class specific path of action, The class is not provided directly go to the handover result 20 method:action类中具体的action方法 21 --> 22 <action name="start" method="{1}"> 23 <result> 24 /WEB-INF/index.jsp 25 </result> 26 </action> 27 28 </package> 29 </struts>