作者在 2010-11-01 10:52:47 发布以下内容
1.
需要添加的jar包:Struts2-core.jar
Xwork.jar
Ognl.jar
Freemarker.jar
Commons-logging.jar
2. 在web.xml中的配置:
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
3. 在struts.xml中的配置:
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<!-- 包含其他xml文件 -->
<include file="xxx.xml"/>
<!-- package的具体配置 -->
<package name="Struts2" extends="struts-default">
<action name="typeAction" class="action.ConversionAction">
<result name="success">/conversion.jsp</result>
</action>
</package>
</struts>
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<!-- 包含其他xml文件 -->
<include file="xxx.xml"/>
<!-- package的具体配置 -->
<package name="Struts2" extends="struts-default">
<action name="typeAction" class="action.ConversionAction">
<result name="success">/conversion.jsp</result>
</action>
</package>
</struts>