Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

NullPointerException error with requestDispatcher.forward() statement  RSS feed

 
Greenhorn
Posts: 18
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got below error in my servlet while getting two values, username & password, from jsp. As I want to put them in my database I have just
add CheckSrvlt.java while running this I got below error message..

java.lang.NullPointerException
org.apache.jsp.Home_jsp._jspService(Home_jsp.java:113)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
CheckSrvlt.doPost(CheckSrvlt.java:66)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


Here is my CheckSrvlt doPost():



Anyone have the idea...? Once i have tried out by removing coockies of my browser as it gives me http status 500 message, some site suggest me to do like that.. but it's not working.. Thanks..in advance..I know that here, masters of JAVA are available..and give me the exact idea..why this error occurred.
 
Bartender
Posts: 1800
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post your jsp code. My first guess would be a misspelling somewhere (case matters) because one or both of your parameters are null.

You can use FireBug to see what parameters are being sent.
 
Gautam Joshi
Greenhorn
Posts: 18
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, there is not any kind of spelling mistakes in my code.., but I am using wamp server and at the time of running this code..wamp is not running. That's the only reason why I got NPE error.

And yes, thanks for your reply. I appreciate it.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure the path of home.jsp is correct. If it is not in default folder, then give its complete path.
 
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!