I created a question site and I want to click on the radio button options when a user answers questions. The selected option should be loaded into a temporary table in HTML. When the user decides that he wants to complete the test, he will press the Ajax button at the bottom of the table, and I will add all the answers to MySQL.
I am able to upload answers with each click on the radio button, but when I select the next question on pagionation-e, the previous answer becomes null .
How do I solve this problem?
<html> <head> <% Logger log = Logger.getLogger("Test"); %> <% Long qnum = (Long) session.getAttribute("qnumer"); %> <% String answer = (String) session.getAttribute("answer"); %> <% log.info(qnum + answer); %> <% String[] answerqlist = new String[6]; %> <% switch (Integer.parseInt(String.valueOf(qnum))) { case 1: String a1 = answer; answerqlist[0] = a1; break; case 2: String a2 = answer; answerqlist[1] = a2; break; case 3: String a3 = answer; answerqlist[2] = a3; break; case 4: String a4 = answer; answerqlist[3] = a4; break; case 5: String a5 = answer; answerqlist[4] = a5; break; case 6: String a6 = answer; answerqlist[5] = a6; break; } %> </head> <body> <table cellspacing="0" width="100%" style="border: solid 1px;"> <thead> <tr> <th>1</th> <th>2</th> <th>3</th> <th>4</th> <th>5</th> <th>6</th> </tr> </thead> <tbody> <tr align="center"> <td><%=answerqlist[0]%></td> <td><%=answerqlist[1]%></td> <td><%=answerqlist[2]%></td> <td><%=answerqlist[3]%></td> <td><%=answerqlist[4]%></td> <td><%=answerqlist[5]%></td> </tr> </tbody> </table> </body> </html>