表格中每行数据后面都有一个修改和删除的按钮,单击修改按钮会有一个模态框弹出并把此行数据传入模态框中的表单供用户修改,之后可以提交更改。
可是现在我点每一个修改按钮弹出的模态框里面数据都是第一条的,这是为什么呢?
谢谢好心人指教~弄了好半天没解决≧﹏≦
2 回答
不想长胖的小巫女
TA贡献1条经验 获得超0个赞
<%
BDUndertakeTaskingDAO underTaskingDao=new BDUndertakeTaskingDAO();
ArrayList all=underTaskingDao.qryAllBDUndertakeTasking();
for(int i=0;i<all.size();i++){
BDUndertakeTasking underTasking=new BDUndertakeTasking();
underTasking=(BDUndertakeTasking)all.get(i);
%>
<form name="<%="f"+i %>" >
<tr bgcolor="fff2df">
<td><div align="center"><%=underTasking.getProjectNo() %></div></td>
<td><div align="center"><%=underTasking.getStudentNo() %></div></td>
<td><div align="center"><%=underTasking.getRank() %></div></td>
<td><div align="center"><%=underTasking.getUndertakerole() %></div></td>
<td border="0"><div align="center">
<button data-toggle="modal" data-target="#changeModal" >修改</button>
<button data-toggle="modal" data-target="#deleteModal">删除</button>
</div>
</td>
</tr>
</form>
<!----------------------------------- 信息修改模态框 ------------------------------------------------>
<div class="modal fade" id="changeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<form action="<%=contextPath %>/servlet/updateBDUndertakeTasking" name="<%="f"+i %>" method="post">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">信息修改</h4>
</div>
<!----------------------- 从数据库获取数据到信息修改模态框 ------------------------------------>
<div class="modal-body">
课题编号:<input type="text" name="projectNo" id="projectNo" value="<%=underTasking.getProjectNo() %>"><br><br>
学 号:<input type="text" name="studentNo" id="studentNo" value="<%=underTasking.getStudentNo() %>"><br><br>
排 名:<input type="text" name="rank" id="rank" value="<%=underTasking.getRank() %>"><br><br>
承担角色:<input type="text" name="undertakerole" id="undertakerole" value="<%=underTasking.getUndertakerole() %>">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<input type="submit" class="btn btn-primary" value="确认修改">
</div>
</form>
</div>
</div>
</div>
添加回答
举报
0/150
提交
取消