First, Jar
Commons-fileupload-1.2.1.jar
Commons-io-1.3.2.jar
Freemarker-2.3.15.jar
Ognl-2.7.3.jar
Struts2-core-2.1.8.1.jar
Xwork-core-2.1.6.jar
Second, the configuration file
1.struts.xml
1<?xml version= "1.0" encoding= "UTF-8"?>2<!DOCTYPE Struts public3"-//apache software foundation//dtd Struts Configuration 2.0//en"4"Http://struts.apache.org/dtds/struts-2.0.dtd" >5 6<struts>7<!--configured for development mode--8<constant name= "Struts.devmode" value= "true"/>9<!--to configure the extension to action--Ten<constant name= "Struts.action.extension" value= "action"/> One<!--to configure the theme to simple--- A<constant name= "Struts.ui.theme" value= "simple"/> - - the< PackageName= "Default" namespace= "/"extends= "Struts-default" > - -<!--Configure the action for testing, not integrated with spring, class attribute write full name-- -<!--when STRUTS2 is integrated with spring, the class property can write the bean's name-- +<action name= "Test"class= "Testaction" > -<result name= "Success" >/test.jsp</result> +</action> A at -</ Package> - -<!--ADD packages here-- - -</struts>
2.web.xml
1<?xml version= "1.0" encoding= "UTF-8"?>2<web-app version= "3.0"3Xmlns= "Http://java.sun.com/xml/ns/javaee"4Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"5Xsi:schemalocation= "Http://java.sun.com/xml/ns/javaee6http//java.sun.com/xml/ns/javaee/web-app_3_0.xsd ">7<display-name></display-name>8<welcome-file-list>9<welcome-file>index.jsp</welcome-file>Ten</welcome-file-list> One A<!--Configure the core of the STRUTS2 filter-- -<filter> -<filter-name>struts2</filter-name> the<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> + </web-app>
OA Learning Note -002-sruts2.1 configuration