• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

nullpointerexception

 
Li Jenny
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a next.jsp is redirected from the previous.page.
when the previous page link to next.jsp together with query string
so that in the next.jsp can get the string by "request.getParameter('querystring')"
but when i re-submit form in next.

it always error : nullpointerexception , i thing is pointing out the "request.getParameter('querystring')"


i try to prevent null value in java code as belows:


it doesn't work.
how can i prevent this happen?

[Devaka: Added code tags - please UseCodeTags]
 
W. Joe Smith
Ranch Hand
Posts: 710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check to see if your request refrence is null. It sounds like you are trying to call a method on a null object, which is giving you a null pointer exception.
 
Li Jenny
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to prevent null object
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4680
329
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Parameter('querystring').equals(null) doesn't make any sense. Use == operator when you compare something with null.
 
Dhan Kumar
Greenhorn
Posts: 29
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as per the above answer
replace this

by this
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic