struts1的配置

1、web.xml中配置

<servlet>

<servlet-name>action</servlet-name>

<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

<init-param>

<param-name>config</param-name>

<param-value>/WEB-INF/struts-config.xml</param-value>

</init-param>

<init-param>

<param-name>debug</param-name>

<param-value>2</param-value>

</init-param>

<init-param>

<param-name>detail</param-name>

<param-value>2</param-value>

</init-param>

<load-on-startup>2</load-on-startup>

 </servlet>

2、struts-config.xml中配置

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPEstruts-configPUBLIC

"-//ApacheSoftwareFoundation//DTDStrutsConfiguration1.2//EN"

"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">

<struts-config>

<action-mappings>

<actioninput="/index.jsp"path="/test"scope="session"

type="com.test.TestAction">

<forwardname="success"path="/success.jsp"/>

  </action>

 </action-mappings>

</struts-config>

相关推荐