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"
Joined: Jun 22, 2012
what i have done till now is very simple.
i have created a servlet to fetch questions from the database.
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.