Exception creating bean of class com.mycar.struts.form.UserForm: {1}

kedaboy110 2008-05-01 03:55:12
进入页面时抛出异常
javax.servlet.ServletException: Exception creating bean of class com.mycar.struts.form.UserForm: {1}
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.register_jsp._jspService(register_jsp.java:85)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.mycar.filter.EncodingFilter.doFilter(EncodingFilter.java:22)


root cause

总是不能实例化actionForm 各位高手帮我解决下,谢谢!
...全文
159 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
setup37 2009-04-16
  • 打赏
  • 举报
回复
使劲帮你顶,我也遇见这问题了,郁闷死了,我从<A></A>跳转过去就直接报这个错。555555555555555555555555555昨天还好好的呢,今天一开机 就不行了,我也没动哪儿呀
huang_w 2008-05-01
  • 打赏
  • 举报
回复
顶了!支持一下!
kedaboy110 2008-05-01
  • 打赏
  • 举报
回复

配置文件:
<form-beans >
<form-bean name="userForm" type="com.mycar.struts.form.UserForm" />
</form-beans>

<action-mappings >
<action
attribute="userForm"
input="/register.jsp"
name="userForm"
parameter="method"
path="/user"
scope="request"
type="com.mycar.struts.action.UserAction">
<forward name="registersuccess" path="index.jsp" />
<forward name="registerfailure" path="register.jsp"/>
</action>
</action-mappings >


ActionForm 如下(省略getter和setter) :
public class UserForm extends ActionForm {

private String user_name;
private String user_pwd;
private String user_ques;
private String user_ans;
private String user_mail;
private Integer user_sex;
private Integer user_integral;
private Integer user_grade;
private String user_realname;
private String user_rpwd;
private String checkcode;

public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if(this.user_name == null || "".equals(this.user_name)) {
errors.add("user_name",new ActionMessage("user.username.null"));
}
if(this.user_pwd == null || "".equals(this.user_pwd)) {
errors.add("user_pwd", new ActionMessage("user.userpwd.null"));
}
if(this.user_rpwd == null || "".equals(this.user_rpwd)) {
errors.add("user_rpwd", new ActionMessage("user.userpwd.null"));
} else {
if(!(this.user_pwd.equals(this.user_rpwd))) {
errors.add("user_rpwd", new ActionMessage("user.confirm.error"));
}
}
if(this.user_ques == null || "".equals(this.user_ques)) {
errors.add("user_ques", new ActionMessage("user.userques.null"));
}
if(this.user_ans == null || "".equals(this.user_ans)) {
errors.add("user_ans", new ActionMessage("user.userans.null"));
}
if(this.checkcode == null || "".equals(this.checkcode)) {
errors.add("checkcode", new ActionMessage("checkcode.null"));
}
return errors;
}
register.jsp 如下 :

<body>
<html:form action="/user?method=register">
<table>
<tr><td>用户帐号:</td><td>
<html:text property="user_name"/></td><td>
<html:errors property="user_name"/></td></tr><tr><td>用户密码: </td><td>
<html:text property="user_pwd"/></td><td>
<html:errors property="user_id"/></td></tr><tr><td>确认密码: </td><td>
<html:text property="user_rpwd"/></td><td>
<html:errors property="user_rpwd"/></td></tr><tr><td>丢失密码提示问题:</td><td>
<html:text property="user_ques"/></td><td>
<html:errors property="user_ques"/></td></tr><tr><td>丢失密码问题答案:</td><td>
<html:text property="user_ans"/></td><td>
<html:errors property="user_ans"/></td></tr> <tr><td>用户邮箱:</td><td>
<html:text property="user_mail"/></td><td>
<html:errors property="user_mail"/></td></tr><tr><td>性别:</td><td>
<html:text property="user_sex"/></td><td>
<html:errors property="user_sex"/></td></tr><tr><td>真实姓名: </td><td>
<html:text property="user_realname"/></td><td>
<html:errors property="user_realname"/></td></tr><tr><td>验证码:</td><td>
<html:text property="checkcode"/></td><td><img src="image.jsp"/></td></tr><tr><td>
<html:submit value="提交"/></td><td>
<html:cancel value="重置"/></td></tr>
</table>
</html:form>
</body>

各位高手帮帮忙!!!!

67,538

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧