Code Bye

The server encountered an internal error () that prevented it from fulfillin

 

HTTP Status 500 – 

——————————————————————————–

type Exception report

message 

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

exception 

org.apache.jasper.JasperException: An exception occurred processing JSP page /register.jsp at line 9

6:  if (request.getParameter(“login”) != null) {
7:  String username = request.getParameter(“username”);
8:  String password = request.getParameter(“password”);
9:  float money=Float.parseFloat(request.getParameter(“money”)); 
10:  UsersVo vo = new UsersVo();
11:  vo.setUsername(username);
12:  vo.setPassword(password);

Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:519)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:428)
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)

root cause 

java.lang.NullPointerException
sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:991)
java.lang.Float.parseFloat(Float.java:422)
org.apache.jsp.register_jsp._jspService(register_jsp.java:65)
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:386)
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)

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


10分
float money=Float.parseFloat(request.getParameter("money"));
//此处request.getParameter("money") ==null,所以 java.lang.NullPointerException,你 debug看一下是
//不是为空

1分
HTTP Status 500 – 

——————————————————————————–

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:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
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)

root cause 

java.lang.NullPointerException
org.apache.jsp.index_jsp._jspService(index_jsp.java:299)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
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)

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

这个怎么解决啊?


1分
求解,我也遇到这种问题

8分
register.jsp at line 9
java.lang.NullPointerException,

找关键错误信息,  明显是 Float.parseFloat()的时候报 的错,  
你String moneys=request.getParameter(“money”);

 打印一下moneys 看看 有没有值,

我也遇到这个问题,我用的是struts2+hibernate做的 jsp项目,你解决这个问题没有,有的话说一声
引用 7 楼 u010962671 的回复:

我也遇到这个问题,我用的是struts2+hibernate做的 jsp项目,你解决这个问题没有,有的话说一声

解决了么?我也遇到了这个问题,求解啊

首先用request.getParamseter(“”)获取String类型的值,然后判断是否为null,如果为null,float.parfloat()会报空指针异常和数据转换异常的,要先判断获取的值是否为null
求解这个类容
楼主我已经改了密码和用户名了可是还是出现

求教 求教

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明The server encountered an internal error () that prevented it from fulfillin