File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Getting null point exception Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Getting null point exception Error" Watch "Getting null point exception Error" New topic

Getting null point exception Error

Mayank Adhikari

Joined: Nov 17, 2012
Posts: 13
Hi All,

Steps performed:

1. created a test2.jsp page where it display a list of players in a DROP-DOWN menu by querying database using JDBC.

2. User select a player from the above drop down list and click "SUBMIT" the player name which will get POST to a servlet "".

3. The Player name will be processed by and the player name will be returned back to the test2.jsp page.

4. using this player name(provided by in the above steps) in test2. jsp page to get the furthur stastics for the player by quering the database againg.

ISSUE: On Step 4 i am getting Null point exception ERROR.

Please find below my code.


********************************************************* >>>>

Amit Ghorpade

Joined: Jun 06, 2007
Posts: 2851

Make sure to UseCodeTags while posting your code, I have added them in the above post for you.

|Asking Good Questions|
Amit Ghorpade

Joined: Jun 06, 2007
Posts: 2851

Firstly, no one writes that much scriptlet code in a JSP, you are defying the entire JSP purpose.
Did you see the stack trace to find out what part of the code is throwing the NPE?
Moreover the idea of submitting the entire JSP is not really good, do you want the DB code to go over again?
You need AJAX.
caleb momanyi
Ranch Hand

Joined: Jun 17, 2012
Posts: 43

in addition to all that has been said. you should also try to use a debugger with break points in your code, you can find out what variable is null at the point of executive to throw the exception
I agree. Here's the link:
subject: Getting null point exception Error
It's not a secret anymore!