我正在尝试学习struts并遇到了问题。所以这里有它的长短:
所以我到目前为止最好的猜测是,当我创建第二个动作类型或者web xml动作映射不正确时,我已经以某种方式破坏了配置。那么有谁能告诉我什么是不正确的?
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<form-beans>
<form-bean name="searchForm" type="com.agreen.struts.test.SearchForm" />
<form-bean name="addForm" type="com.agreen.struts.test.AddEmployeeForm" />
</form-beans>
<global-forwards>
<forward name="search" path="/search.jsp" redirect="false" />
<forward name="addEmployee" path="/addEmployee.jsp" redirect="false" />
</global-forwards>
<action-mappings>
<action path="/search"
type="com.agreen.struts.test.SearchAction"
name="searchForm"
scope="request"
validate="true"
input="/search.jsp"></action>
<action path="/addEmployee"
type="com.agreen.struts.test.AddEmployeeAction"
name="addForm"
scope="request"
validate="true"
input="/addEmployee.jsp"></action>
</action-mappings>
<message-resources parameter="MessageResources" />
</struts-config>
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app>
<!-- Action Servlet Configuration-->
<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>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- The Welcome File List -->
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>
</web-app>