怎么把forEach循环出来的多个radio,提交到后台,并将它存入数据库
如何把下面获得的选择题答案插入到数据库
<form id="form2" name="form2" action="/institutions/answerServlet" method="post">
<c:forEach items="${paper.topics}" var="topics" varStatus="status">
<table width="970" height="132" border="0" align="center" cellspacing="0"style="border:1px solid #0099FF" >
<tr>
<td width="39" valign="top">${topics.topicNumber}.</td>
<td colspan="2" align="left">${topics.topicName}</td>
</tr>
<tr>
<td> </td>
<td width="48">
<label>
<input type="radio"
name="answerResult${status.index}" value="A"
/>
A. </label>
</td>
<td width="861" align="left">${topics.topicOptiona}</td>
</tr>
<tr>
<td> </td>
<td width="48">
<label>
<input type="radio"
name="answerResult${status.index}" value="B"/>
B. </label>
</td>
<td align="left">${topics.topicOptionb}</td>
</tr>
<tr>
<td> </td>
<td width="48">
<label>
<input type="radio"
name="answerResult${status.index}" value="C"
/>
C. </label>
</td>
<td align="left">${topics.topicOptionc}</td>
</tr>
<tr>
<td> </td>
<td width="48">
<label>
<input type="radio"
name="answerResult${status.index}" value="D"
/>
D. </label>
</td>
<td align="left">${topics.topicOptiond}</td>
</tr>
</table>
<table width="970" height="15" align="center" border="0" cellspacing="0">
<tr>
<td width="15"><input
style="height:15px;" type="hidden" name="pid" value="${topics.topicNumber}"></td>
<td><input style="height:15px;" name="tid" type="hidden" value="${user.usersId}"></td>//获得题目id
<td> <input
style="height:15px;" name="uid" type="hidden" value="${paper.paperId}"></td>
</tr>
</table>
</c:forEach>
<table width="970" height="15" align="center" border="0" cellspacing="0">
<tr>
<td align="right"> <input type="submit" value="交卷"/>
</td>
<td align="left"> <input type="submit" value="打印" onClick="javascript:window.print();"/></td>
</tr>
</table>
</form>
后台SERVLET
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Answer answer=new Answer();
Integer uid= new Integer(request.getParameter("uid"));用户id
Integer pid= new Integer(request.getParameter("pid"));
Integer tid=new Integer(request.getParameter("tid"));//题目id
Map map = request.getParameterMap();
// String answerResult=request.getParameter("answerResult");
PaperDAO pdao = new PaperDAO();
Paper paper = pdao.findById(pid);
UsersDAO udao = new UsersDAO();
Users users = udao.findById(uid);
TopicDAO tdao = new TopicDAO();
Topic topic = tdao.findById(tid);
AnswerBiz abiz=new AnswerBiz();
// answer.setAnswerResult(answerResult);
Set<String> key = map.keySet();
for (Iterator it = key.iterator(); it.hasNext();) {
String s = (String) it.next();
answer.setAnswerResult(s);
}
answer.setUsers(users);
answer.setTopic(topic);
answer.setPaper(paper);
answer=abiz.AnswerAdd(answer);
request.getSession().setAttribute("users",users);
request.getSession().setAttribute("answer", answer);
request.getRequestDispatcher("reception/daan.jsp").forward(request, response);
}
请你帮我看下要怎么实现啊!非常感谢