struts的一个错误!
我是按照struts in action的操作步骤写的代码但是如下错误:
原码:
RegisterAction.java
package com;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import java.io.*;
public class RegisterAction extends Action
{
public ActionForward execute(ActionMapping mapping,
ActionForm form,HttpServletRequest req, HttpServletResponse res)
{
RegisterForm rf=(RegisterForm) form;
String username=rf.getUsername();
String password1=rf.getPassword1();
String password2=rf.getPassword2();
if (password1.equals(password2))
{
try
{ UserDirectory.getInstance().setUser(username,password1);
return mapping.findForward("success");
}catch(UserDirectoryException e)
{return mapping.findForward("failure");
}
}
return mapping.findForward("failure");
}
}
package com;
import org.apache.struts.action.*;
public class RegisterForm extends ActionForm
{
protected String username;
protected String password1;
protected String password2;
public String getUsername(){return this.username;};
public String getPassword1(){return this.password1;};
public String getPassword2(){return this.password2;};
public void setUsername(String username){this.username=username;};
public void setPassword1(String password){this.password1=password;};
public void setPassword2(String password){this.password2=password;};
};
register.jsp
<%@ taglib uri="/WEB-INF/struts-form.tld" prefix="form" %>
<form:form action="register.do">
UserName:<form:text property="username"/><br>
enter password:<form:password property="password1"/><br>
re-enter password:<form:password property="password2"/><br>
<form:submit value="Register"/>
</form:form>
错误:
javax.servlet.ServletException
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:471)
at org.apache.jsp.register$jsp._jspService(register$jsp.java:223)
其中:不知道是什么原因,struts配置不知道有没有错误;