首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

error分析,求

2013-09-11 
error分析,求大虾由index.jsp 跳转到 save.jsp 除此错,地址栏显示是正确的localhost:8080/struts/index.js

error分析,求大虾
由index.jsp 跳转到 save.jsp 除此错,地址栏显示是正确的localhost:8080/struts/index.jsp to localhost:8080/struts/save.jsp
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:538)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:413)

root cause

java.lang.NullPointerException
org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:746)
org.apache.struts2.components.UIBean.end(UIBean.java:481)
org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:43)
org.apache.jsp.save_jsp._jspx_meth_s_005ftextfield_005f0(save_jsp.java:162)
org.apache.jsp.save_jsp._jspx_meth_s_005fform_005f0(save_jsp.java:117)
org.apache.jsp.save_jsp._jspService(save_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:413)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.33 logs.
Apache Tomcat/6.0.33

[解决办法]
java.lang.NullPointerException
空指针异常
org.apache.jsp.save_jsp._jspx_meth_s_005ftextfield_005f0(save_jsp.java:162)
org.apache.jsp.save_jsp._jspx_meth_s_005fform_005f0(save_jsp.java:117)
org.apache.jsp.save_jsp._jspService(save_jsp.java:79)
你好好检查一下save页面参数的值
[解决办法]
user对象是空的吧。
[解决办法]
User user=new User() 實例化
[解决办法]
为user加一个空的构造方法,否则struts无法帮你实例化,当然你也可以自己new一个出来
[解决办法]

探讨

我把user.firstname 改成 firstname 还是有问题

<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<……

[解决办法]
UserService service 有可能为空。用debug呀
[解决办法]
对付空指针 一直觉得好办法就是把可能空的地方断点 debug一下

可以看api
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html

热点排行