配置了一个struts,但运行提交一个do的时候,tomcat根本没有任何反映。
而IE却提示:
HTTP Status 404 - /test/WebRoot/reg
The requested resource (/test/WebRoot/reg) is not available.请问是我struts-config.xml配置错了,还是找不到路径??有时tomcat还会显示:/WEB-INF/web.xml not found的错误!!!!!
是不是我的struts配置错了?应该怎么做??谢谢
而IE却提示:
HTTP Status 404 - /test/WebRoot/reg
The requested resource (/test/WebRoot/reg) is not available.请问是我struts-config.xml配置错了,还是找不到路径??有时tomcat还会显示:/WEB-INF/web.xml not found的错误!!!!!
是不是我的struts配置错了?应该怎么做??谢谢
<form action="/aaa.do" method="post">
</form>web.xml中:
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
struts-config.xml中:
<action-mappings>
<action path="/aaa.do" type="hello.HelloAction" name="HelloForm" scope="request" validate="true" input="/hello.jsp">
<forward name="SayHello" path="/hello.jsp" />
</action>
</action-mappings>
以上只是写出了比较关键的内容,仅供参考
path中就不用.do了
页面:
<form action="/aaa.do" method="post">
</form>web.xml中:
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
struts-config.xml中:
<action-mappings>
<action path="/aaa" type="hello.HelloAction" name="HelloForm" scope="request" validate="true" input="/hello.jsp">
<forward name="SayHello" path="/hello.jsp" />
</action>
</action-mappings>
这样写路径是对应的吗?? 谢谢
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletResponse response,
HttpServletRequest request
) {
System.out.println("=====================");
return mapping.findForward("success");
}
}根本就进不到action里去!!!!!1郁闷
web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app 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"
version="2.4">
<description>
Struts Web Application.
</description>
<display-name>Struts Web Application</display-name>
<!-- Standard 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>2</load-on-startup>
</servlet> <!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
eclipse配置的。 大家用过myeclipse吗?
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<form-beans>
<form-bean name="××Form" type="cn.com.……" />
这里配好了吗?
"××Form"名要和下面<action name="××Form"
对应