wood burning stoves*
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Getting null point exception Error" Watch "Getting null point exception Error" New topic
Author

Getting null point exception Error

Mayank Adhikari
Greenhorn

Joined: Nov 17, 2012
Posts: 12
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 "Playerprofile.java".

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

4. using this player name(provided by Playerprofile.java 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.


test2.jsp>>>




*********************************************************

Playerprofile.java >>>>



Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

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


SCJP, SCWCD.
|Asking Good Questions|
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

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: http://aspose.com/file-tools
 
subject: Getting null point exception Error