求救高手,谢谢!HTTP Status 500 - 错误
在 Status应用下,写一用户注册页面提交时页面报以下错误:
javax.servlet.ServletException: Action[/register1] does not contain specified method (check logs)
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
java.lang.NoSuchMethodException: Action[/register1] does not contain specified method (check logs)
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:264)
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
org.apache.struts.actions.MappingDispatchAction.execute(MappingDispatchAction.java:169)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
说的是找不到指定的方法register1,但是有这个方法的啊;具体如下:
register.jsp :
<%@page language="java" contentType="text/html;charset=gbk"%>
<center>
<h2><font color="green">用户注册</font></h2>
</center>
<form method="post" action="<%=request.getContextPath()%>/register1.do">
<table border="0" align="center">
<tr>
<td>用户名*:</td>
<td><input type="text" name="userName" size="10"></td>
<tr>
<td>密码*:</td>
<td><input type="password" name="password" size="10"></td>
<tr>
<td>重复密码*:</td>
<td><input type="password" name="repeatPassword" size="10"></td>
<tr>
<td>邮政编码:</td>
<td><input type="text" name="postCode" size="10"></td>
<tr>
<td>移动电话*:</td>
<td><input type="text" name="callPhone" size="15"></td>
<tr>
<td>办公电话:</td>
<td><input type="text" name="officePhone" size="15"></td>
<tr>
<td>家庭电话:</td>
<td><input type="text" name="homePhone" size="15"></td>
<tr>
<td>Email:</td>
<td><input type="text" name="email" size="30"></td>
<tr>
<td>家庭住址:</td>
<td><input type="text" name="homeAddress" size="50"></td>
</table>
<center>
<input type="submit" value="提交">
</center>
</form>
<center>
<h3><font color="red">注意:</font><font color="green">带*号的必须填写</font></h3>
</center>
struts-config.xml :
</action>
<action path="/register1" type="com.yangxb.soppingcart.action.UserAction" parameter="register1">
<forward name="login" path="/page/login.jsp"/>
</action>
Action 类:
public ActionForward register1(ActionMapping mapping,ActionForm form
,HttpServletRequest request,HttpServletResponse response){
String userName=request.getParameter("userName");
String password=request.getParameter("password");
String postCode=request.getParameter("postCode");
String callPhone=request.getParameter("callPhone");
String officePhone=request.getParameter("officePhone");
String homePhone=request.getParameter("homePhone");
String email=request.getParameter("email");
String homeAddress=request.getParameter("homeAddress");
User user=new User();
user.setName(userName);
user.setPassword(password);
user.setPostCode(postCode);
user.setCallPhone(callPhone);
user.setOfficePhone(officePhone);
user.setHomePhone(homePhone);
user.setEmail(email);
user.setAddress(homeAddress);
UserService us=new UserService();
try {
us.Register(user);
}catch (Exception e) {
e.printStackTrace();
}
return mapping.findForward("login");
}
求救位高手师兄,谢谢.