javax.servlet.ServletException: null
在测试我一直在开发的基于 apache strut 的小型 Web 应用程序时收到以下错误,问题的症结在于不知何故将空的 httpservletrequest 请求参数传递给了扩展 Action 类中的 Actionforward 执行函数?
我对 struts 使用的了解有限,因此,对这种错误行为的解释超出了我的范围,非常感谢任何帮助。下面包含例外情况..
javax.servlet.ServletException: null
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.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
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.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache
Tomcat/5.5.4 logs.
Recieved the following error whilst testing a small apache strut based web application ive been working on, the crux of the matter is that somehow a null httpservletrequest request parameter was passed to an Actionforward Execute function within an extened Action class??
My knowledge of struts usage is limited so, an explainition of this erranous behaviour is beyond me, any help greatly appreciated. Exception included below..
javax.servlet.ServletException: null
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.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
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.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache
Tomcat/5.5.4 logs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抱歉没有早点回到这个问题。
所描述的错误是由 struts-config.xml 中的操作映射中缺少 serviceForm Bean 规范引起的。用户第一次导航到有问题的网页时,ServiceForm bean 不存在,因此创建它是为了存储相对的 actionForm 值(没有发生错误)。
然而,当用户在其他地方尝试导航回网页时,会尝试访问创建的 serviceForm bean 数据,而该数据尚未在 strut 中指定。因此空指针崩溃
。缺少名称=“serviceForm”。
希望这个解释有帮助..
Apologies for not getting back to this sooner..
The error described was caused by a missing serviceForm Bean specification within an action mapping in struts-config.xml. The first time the user navigated to the offending web page the ServiceForm bean did not exist, so was created to store relative actionForm values (no errors occured).
However when the user tried to navigate back to the web page after being elsewhere, access was attempted to the created serviceForm bean data, which hadn't been specified in the strut.. hence the null pointer crash..
Eg. name="serviceForm" was missing.
Hope this explainition is helpful..