• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

null pointer exception in servlet  RSS feed

 
Ranch Hand
Posts: 153
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i coding a simple calculator with Tomcat, jsp, servlet and bean, after submit the tomcat response error 500 .

Etat HTTP 500 -

type Rapport d''exception

message

description Le serveur a rencontré une erreur interne qui l''a empêché de satisfaire la requête.

exception

java.lang.NullPointerException
sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1017)
java.lang.Double.parseDouble(Double.java:540)
com.calculator.servlets.Calculator.doPost(Calculator.java:52)
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

note La trace complète de la cause mère de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/8.0.43.
Apache Tomcat/8.0.43



i have 2 textbox and this choise operand /;*;-;+; and of course totaly !
when i read the error 500 the tomcat tell may be issues with parsing double variable !
this the code of jsp
l
this the code of the servlet


i think that my bean is good, no error !
well like i tell you the parsing string to double up exception
can do for get arrond it

Regards
Philippe
 
Author and ninkuma
Marshal
Posts: 66786
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basic debugging: what do the values of num2 and num2 equal?
 
Philippe Ponceblanc
Ranch Hand
Posts: 153
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Basic debugging: what do the values of num2 and num2 equal?



>> can you explain me whitch line you sait, in the servlet but where
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66786
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can answer your own question: where in your servlet do this values get assigned? Do they contain the expected values?
 
Philippe Ponceblanc
Ranch Hand
Posts: 153
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:You can answer your own question: where in your servlet do this values get assigned? Do they contain the expected values?



i think here String num1= request.getParameter("num1");
    String num2= request.getParameter("num2");
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66786
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Are the values what you expect?
 
Philippe Ponceblanc
Ranch Hand
Posts: 153
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Yes. Are the values what you expect?




i do like this

but same issue

i this the error is here 
i do a mistake method >> request or getParameter !
i know java but the jsp a little !
whitch method can i choise for get arround it ?
please tell me !

see ya_
philippe
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66786
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the problem is later. Probably when you are trying to convert the values. Have you checked if either num1 or num2 are null?
 
Philippe Ponceblanc
Ranch Hand
Posts: 153
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's more serious than that one of my textbox is accessible all the jsp and false
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!