How to display single question one by one in JSP page?
Hi,
I am developing ONLINE examination system
in which i have to maintain One question per page.
so when user click next , Next Question or Random question is displayed on the screen with the same page...
e.g.
if my page is :" Quest.jsp" in which i am displaying question 1
when user attempt it and press next it will just change question and
options not Page.. page must be Quest.jsp only..
HOW to achieve this.. i have tried but it will display all questions in one page and for each question 1 submit buttion it displayed..
what should i do ?
please give me answer as soon as possible..
[663 byte] By [
Ghanshyama] at [2007-11-26 13:54:09]

# 1
Use AJAX, this will bring the questions from the server without referesh the JSP page.
# 2
dear i can't change the technology,,, just simply for displaying pageif any alternatives in JSP then only inform me ...thanks for a good suggestion...i need help inside JSP
# 3
When you click Next, using Javascript submit the same action again(input is same JSP page), and bring the next question randomly. Is that you want? Thanks.
# 4
If i use java script , it will restart count down from beginning..so exam time will be extended whenever user click refresh.
# 5
>If i use java script , it will restart count down from beginning..
>so exam time will be extended whenever user click refresh.
Yeah that's right but still you can manage it by saving the time counter.
I have 3 work around cases for the problem you have stated.
Case 1). Try using Hidden Frames
Case 2).
USAGE OF JAVASCRIPT IN SYNC @ THE CLIENT SIDE - TEMP RESOURCE :
Make use of Javascript and try creating a Cookie or try accesing Clipbroad (Browser Specfic) now while intialiing Timer(@ the start of the exam) in your Application try setting it to ZERO.
Now while running the application write an action on onload initlalise timer value to the value in the Cookie / Clipbroad and on onunload copy the present value of timer to a Cookie / Clipbroad.
@ the end of exam delete the cookie / clear clipboard
This Should solve your problem but it is bit browser specific.
Case 3).
USAGE OF JAVASCRIPT IN SYNC WITH SERVER SIDE SESSION:
Even this is a similar methodology but the U wud use Session instead of cookies.....
create a session attribute named timer and initialize it to zero at the start of the examination.... ( eg:session.setAttribute("timer", new Integer(0) ) )
In the View Part use a JSP expression and initialize the timer value to that one in the session.
onunload make use of XmlHttpRequest Object (AJAX call) and send the present timer value to timer specific Servlet / JSP which again modifies session.
( eg:session.setAttribute("timer", Integer.parseInt(request.getParameter("timer") ) ) ); )
@ the end of exam remove the timer attribute in the session.
Hope it helps
REGARDS,
RaHuL
# 6
Dear Ghanshyam,
Your question is to display many question on the same JSP file.
Good Doubt.
I too developed a similar application for my college. There is used Hidden variable for time. Similiarly i used sesions for storing the number of correctly answered questions (delimited by commas) So, when the user clicks "END TEST" a new page / different form of the same file will be displayed which contains the summary of the score gained by the user.
I hope i have cleared your doubt. By this you don't need to implement AJAX or XML or any other. But remember your action should be same file name.
Regards,
Renga
# 7
Hi rahulNice for replying..actually i don't know anything about AJAX, and you used itcan u give me some code for displaying questions in JSP code ? ?THanks
# 8
Hi,
can u give me solution to display Question One by One in our Same JSP page ?
u told me complex idea but its browser specific and would not run if its not compatible.
My QuestionID is like C0001 for "C" test
CPP0001 for "CPP" test
so how can i display questions one by one if i select language CPP ?
int a;
a = Integer.parseInt(request.getParameter("action"));
Here a gives value 1,2,3,4 etc... when we click next Question
but my QUestionID is like shown above...
so how can i manage it ?
And one major thing is putting down Reverse countdown timer.
how to put it. if we using JSP code or java code instead JavaScript. ?
Plz reply me...
# 9
can u please clarify the doubts ,
I use the following files
Login - which get the serial no from the user if the no is correct display next page
i.e Question page-display one qs per one page after the time over or the user click next button goes to the
Validation page- which check for the correct answer then it maintain the score(result) in session variable, and redirect the page to question page untill for 10 times since the total number of question is 10. the result are dynamically increased by retrieving from the session
then after the 10 question is over then result page is called where the result of the student is displayed like "your score is 5 out of 10" this much in etl, olap etc.
Then If the user click exit button in question page the marks are not evaluated then the exit page is displayed.
I clear the session variable in the first and last page , ie Login,result and exit pages.
I use "Post" method in all the form
Now the Problem is
1) If the user enter the sno and then it goes to the next page "question" page the parameter for the question no is 0 since it is an array.
thing is "I used the post method only,
why it is showing the parameter ?so that the user can change the question by changing the number as 0, 1, 2, like that
How to solve this problem. (HOW to hide that questionNo parameter? 2) If I refresh the page the time get reset to the starting time I use count down time maximum time is 60 seconds i.e., one minute for single question or per question
3) how to change the default confirm box option as yes and no instead ok and cancel.
Thanks in advance
karsa at 2007-7-8 1:32:35 >

# 10
The paging concept will give an better solution for this problem.try to implement the paging concept to solve this problemBala
# 11
Can you please explain a bit in detail about the paging concept so that I can try to implement.
karsa at 2007-7-8 1:32:35 >
