开发环境:win7旗舰版,tomcat8,jdk1.8,struts1
主要问题:jsp页面请求actioon后,报 HTTP Status 500 - No action instance for path /userAction could be created
项目基本上都是手写的,几个文件位置及内容如下:
项目名:969mall,路径(d:\tomcat8.0\webapps\969mall)
969mall文件夹下有: regist.jsp、WEB-INF文件夹
WEB-INF文件夹里面有:struts-config.xml、web.xml、classes文件夹、lib文件夹(空的)
classes文件夹里有:UserAction.java、mypack文件夹
mypack文件夹里有:UserAction.class
struts.jar、servlet-api.jar在tomcat8/lib里面
regist.jsp 代码如下:
主要代码:form action="userAction.do" method="post"
<%@ page contentType="text/html;charset=gbk" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
用户注册页面
* 为必填项,为便于商超发货,建议输入有效的收货地址。 | |
用户姓名: | * |
---|---|
手机号: | * |
收货地址: | |
邮编: | |
身份证号: | |
web.xml 代码如下:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
Welcome to Tomcat
Welcome to Tomcat
action
org.apache.struts.action.ActionServlet
config
/WEB-INF/struts-config.xml
application
ApplicationResources
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
struts-config.xml 代码如下:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<action-mappings>
<action name="userFormAction" type="mypack.UserAction" path="/userAction">
<forward name="regSucceed" path="/regsucceed.jsp"/>
</action>
</action-mappings>
UserAction.java 代码如下:
package mypack;
import javax.servlet.http.*;
import org.apache.struts.action.*;
import java.util.ArrayList;
public class UserAction extends org.apache.struts.action.Action{
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response){
System.out.print("execute ....");
return mapping.findForward("regSucceed");
}
}
由于代码被CSDN解析了,没有显示完整的代码,本人拍了照片请大家帮忙看看
哪位朋友能帮忙解决这个问题,200C币奖励,说话算话,在线等。
如果现场过来解决,100元人民币,地铁6号线终点站,海淀五路居站,电话:18910775122。
如果能把struts2基本配置给我讲解一下,并运行简单的登录验证,我愿意出500元,作为感谢,我之前学的struts1,原理的东西还有印象,所以学起来不会太费劲。