关于Struts2配置

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>
3、struts.xml
<?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>
posted @ 2011-03-30 14:49  勇泽  阅读(308)  评论(0编辑  收藏  举报