File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Online Examination-JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Online Examination-JSP" Watch "Online Examination-JSP" New topic

Online Examination-JSP

Kailash karayat

Joined: Jun 22, 2012
Posts: 10

I want to create a online examination system.

i want to know to how to get questions 1 by 1 on the same jsp page and on clicking the submit button the result should be saved in database.

thanks in advance
Aniruddh Joshi
Ranch Hand

Joined: Jul 29, 2008
Posts: 275

You can call a servlet to get the next question when you click next.
The response will have the new question and will reload the same page.
Submit button can call another servlet to save answer to DB and response can load same page with same/next question.

"One of the best things you could do is to simplify a larger application into a smaller one by reducing its process and complexity - Fowler"
Kailash karayat

Joined: Jun 22, 2012
Posts: 10

what i have done till now is very simple.

i have created a servlet to fetch questions from the database.

servlet code.

and then i have stored the fetched records from the database to arraylist and then i am calling the arraylist in the jsp page.

code for jsp page.

to save the user response i am reloading the same servlet again and again to insert records in the database, my servlet for fetching records have also the code for saving the user's response. this is all what i have done till now, this is also working fine, but there are few issues.

1. i am not able to implement previous button.
2. if suppose my database has 20 questions, then for 19 questions it is saving the user's response and for the last question it is not saving the user's response in the database and giving error.
3.this is also not a good approach as my jsp has a lot of scriptlets, i want to remove this.

i have provided with you all the things which i have done till now now please help me in solving this issue.

thanks in advance.
Nat Pm

Joined: Jan 21, 2013
Posts: 2
i tired your jsp code to display a question
but i am getting like hashcode values like as below


A). com.nata.exam.Dto.QuestionsDto@1bab96e
B). com.nata.exam.Dto.QuestionsDto@1e3f60e
C). com.nata.exam.Dto.QuestionsDto@12f4771
D). com.nata.exam.Dto.QuestionsDto@fb87d1

please help me where i did mistake
I agree. Here's the link:
subject: Online Examination-JSP