Struts异常

页面异常:

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Exception creating bean of class com.mypro.form.OrderForm: {1}
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803

.............................

log记录异常

Error creating form bean of class com.mypro.form.OrderForm
java.lang.NullPointerException
 at org.apache.struts.config.FormBeanConfig.createActionForm(FormBeanConfig.java:212)
 at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:292)
 at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:191)

............

这个异常的引起可能是因为配置文件中的form配置不正确引起的,可以看看相应的actiong,确定form的值是否为null,如果为null,则可能是因为form配置正确引起,可仔细查看相应的action和form配置是否正确,form的class文件是否存在,继承关系是否正确。

 

 

以下为其他可能解决方案,(摘录自:http://faq.javaranch.com/java/CannotCreateBean

This is a very common error in Struts. Below is a list of possible causes in order of their likelihood:

  • You just plain misspelled the form bean class name. Look very carefully at the type attribute you specified in the <form-bean> stanza in the struts-config.xml file. Is there a misspelling? Are any letters in upper-case that should be in lower-case or visa-versa?
  • 你可能只是把bean类的名字拼写错误了,请仔细检查struts-configur.xml中<form-bean>的属性,是否有拼写错误,是否有字母小写的写成了大写或者大写写成了小写?
  • You forgot to compile the form bean. Make sure the class file actually exists in the appropriate subdirectory of WEB-INF/classes.
  • 忘记编译form bean文件,请确保相应的class文件实际地存在于WEB-INF/class子目录下。
  • Your form bean does not extend org.apache.struts.action.ActionForm. This class must be somewhere in the ancestry of your form bean.
  • form bean类不是继承自org.apache.struts.action.ActionForm.ActionForm一定要是你的form的直接或者间接父类
  • You've somehow made it so your form bean has no public constructor with no arguments. Remember, if you added a constructor with arguments, you must also add one without arguments
  • 你可能无意间使你的form bean没有了无参公共构造方法。记住,如果你为form 增加了一个有参数的构造方法,那么一定要为其增加一个无参构造方法。
  • Check to make sure that the package you've placed your bean in is not "java" or "java.something". Java does not allow you to use this package name for your own classes.
  • 确保放置form bean的包不是"java'或者"java.something",Java不允许将这样的包名用于自己定义的类。

翻译的不太准确,但是大致意思应该是这样的。请大家凑合看吧。(*^__^*) )


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值