• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting null point exception Error

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 >>>>



 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make sure to UseCodeTags while posting your code, I have added them in the above post for you.
 
Amit Ghorpade
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 43
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Why is the word "abbreviation" so long? And this ad is so short?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic