Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

null pointer handling in jsp

Status
Not open for further replies.

dexter195

Programmer
Jun 18, 2003
220
EU
hi,

ive got some forms that take in info off the user from text boxes. i have this info passed to beans ( in the form of strings) to conformation pages. these conformation pages perform checks on the data to determine the right procedure to take with the information.

when one or more of the text boxes have a null value in them, tomcat spits up a null pointer exception error.

i have code that checks to see if the info taken from the beans is null but it looks like these dont even get run.

is there a way around this because the users need to be informed of the error in plain english, as in redirected back to the input screen with the error shown in red.

is there a way that i can detect null values within the bean and have my own procedures implemented accordingly?

cheers for the help
 
Can you post the [succinct] code that barfs on the NPE (and the checks you make) ?

--------------------------------------------------
Free Database Connection Pooling Software
 
I found the null pointer error. it turned out it wasnt anything to do with the information i was passing to the bean.

im using hibernate to access my database and perform queries. i was using one or two variables from the bean to varify things with the database but the query was returning no results (this should happen under certain circumstances). this is were the null pointers were occuring, as hibernate uses objects to access the database, so i put the code realting to the queryies into try{} and catch{} and that solved the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top