Please solve my "java.lang.NullPointerException" error
Viruthagiri Thirumalvalavan
Greenhorn
Joined: Mar 21, 2010
Posts: 3
posted
0
My project is e learning project. I've a "choose the correct answer" module. When the click the "begin test" button it should fetch the questions and options from database and display it. Instead of that my page displays "java.lang.NullPointerException".
I've assigned unique values for each error. So the exact error it display as
I have found the area of the error. but i couldn't solve it.
My codings are as follows
Please help me to solve this error. i'll be very thankful to you. If you need extra code tell me which part you want to solve this error. I'll post here. thanks to everyone. A little piece of help also appriciated
Step 1: Move the Java code out of the JSP and into a Java class where it belongs. Not only is this a best practice (while putting Java code into a JSP is most definitely not), it will make the code easier to debug.
The line number in the stack is pointing to a line of Java code in the generated Servlet source file, not the JSP.
Depending on which container you're using the actual source file (if saved) will be in different places.
Much easier to solve if your Java code is somewhere other than your JSP.
Most likely objRsQ is null, since that's the only Java operation happening in the try/catch block for error "56"--is there a compelling reason to use completely arbitrary numbers, of all things, to indicate where an error occurred?! How about something like: "Error while trying to display info from the result set" or something that's actually relevant and useful? Just an idea.
In any case, it's almost impossible to make sense of what you're doing: besides all the Java code in a JSP (booooo! :) the random indentation makes understanding any sort of structure much more difficult than necessary.