如何在测验项目中将答案添加到表中?

时间:2017-02-13 12:22:44

标签: java ajax jsp

我创建了测验项目。我从数据库限制1,1中选择问题。用户在每个问题中看到1个问题和4个选项。我希望当点击选项单选按钮valuse按钮必须在下面的表格中设置选项。让用户知道在最后的考试中点击了哪个答案。当用户决定总结考试时,他必须在答案列表表下clikc ajax按钮,并且所有答案都必须在数据库中进行,然后用户才能生成。

我做到了,在点击下一页单选按钮值时,每次点击单选按钮值显示在表格按钮中,优先问题答案值变为空。

如何重新解决这个问题?



<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>
&#13;
&#13;
&#13;

0 个答案:

没有答案