Link to home
Start Free TrialLog in
Avatar of illinosis
illinosis

asked on

not again............

hey all,

ive been trying to figure out how to solve a problem i am having

1)-java.lang.NullPointerException

i get this problem when a user does not check a box (multiple test exam), and thus does not update the persons results in the databse.

How can i solve this??? anyone have any idea?

2) i was wondering how (using jsp and html) can i send a question to a user one at a time( the q are stored in an array), get the answer from the user , process the answer if correct go on to next q and repeat process, if wrong go to solution and how it is worked out page then after the user has read solution they can click on a carry on which will take them on to the next q. and the process continues untiul q finish.

i was thinking of doing it in a html page with frames the first being a jsp page which displays the q and the second being where the user can input their answers.

can neone help me out????

if so v grateful.

thanku ill.
Avatar of kennethxu
kennethxu

>> 1)-java.lang.NullPointerException i get this problem when a user does not check a box (multiple test exam).

if( request.getParameter( "checkboxname" ) == null ) {
   // user didn't check the check box.
   // you must handle this situation, otherwise NullPointerException.
}

>> 2) ....
you can save the current question number in the session:

store:
session.setAttribute( "questionNo", new Integer( questionNo ) );

retrieve:
Integer temp = ((Integer)session.getAttribute( "questionNo" ));
if( temp != null ) questionNo = temp.intValue();

BTW, you haven't follow up on your other questions for a long while, if you keep leaving your questions open without any update, you might find it is difficult to get help in future :)
Avatar of illinosis

ASKER

kennethxu ...thanx 4 ure help will try out tmor.

>>BTW, you haven't follow up on your other questions for a long while, if you keep leaving your questions open without any update, you might find it is difficult to get help in future :)

im soz...when a q is answered and it helps i reward the points and thank the all the peps 4 their help. i will post up updates from now on (i didnt realise this b4
:( ...if u tell me the q that u wud like the update on i will go back to that q and post an update (i didnt realise people still viewed them after they had been answered)...

Thanku...and i will post u an update on this q tmor.

Ill
just click on your name, you'll get the list of Q's belong to you. anyway this is the link:
https://www.experts-exchange.com/Web/Web_Languages/JSP/memberProfile.jsp?mbr=illinosis

it's better to let people know what's the result after you trid their comment, it given solution doesn't work, experts might give you another solution :)
Hey kennethxu,

the exception handling worked.

But i am not too sure wat you mean for my second q. I get wat ure trying to say about session. but i dont get how to fire each q, from one page etc..i think i am getting confused.:(
ASKER CERTIFIED SOLUTION
Avatar of kennethxu
kennethxu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of girionis
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to kennethxu

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer