1、以struts-2.1.6-all.zip为例
2、web.xml
<?
xml version="1.0" encoding="UTF-8"
?>
< web-app version ="2.4"
xmlns ="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation ="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
< 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 >
</ web-app >
< web-app version ="2.4"
xmlns ="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation ="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
< 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 >
</ web-app >
<?
xml version="1.0" encoding="GBK"
?>
<! DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd" >
< struts >
< constant name ="struts.custom.il8n.resources" value ="messageResource" />
< constant name ="struts.il8n.encoding" value ="GBK" />
< package name ="lee" extends ="struts-default" >
< action name ="login" class ="lee.LoginAction" >
< result name ="input" > /login.jsp </ result >
< result name ="ERROR" > /error.jsp </ result >
< result name ="SUCCESS" > /welcome.jsp </ result >
</ action >
</ package >
</ struts >
<! DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd" >
< struts >
< constant name ="struts.custom.il8n.resources" value ="messageResource" />
< constant name ="struts.il8n.encoding" value ="GBK" />
< package name ="lee" extends ="struts-default" >
< action name ="login" class ="lee.LoginAction" >
< result name ="input" > /login.jsp </ result >
< result name ="ERROR" > /error.jsp </ result >
< result name ="SUCCESS" > /welcome.jsp </ result >
</ action >
</ package >
</ struts >