![](https://iknow-base.cdn.bcebos.com/lxb/notice.png)
jsp页面中同一个对象不能用两个c:foreach标签遍历两次? 10
两个c:foreach标签中第一个可以变成生成<option>第二个却不行,items中对象都是同一个后台框架用的springmvc<td>负责人:</td><td><s...
两个c:foreach标签中第一个可以变成生成<option> 第二个却不行,items中对象都是同一个
后台框架用的spring mvc
<td>负责人:</td>
<td>
<select id="dutyerID" name="dutyerID" style="width:205px;height:23px;">
<option></option>
<c:forEach var="ur" items="${ut.getRows()}">//可用
<option value="${ur.getString("id")}">${ur.getString("userRealName")}</option>
</c:forEach>
</select>
</td>
<td>填报人:</td>
<td>
<select id="fillerId" name="fillerId" style="width:205px;height:23px;">
<option></option>
<c:forEach var="fr" items="${ut.getRows()}">//不可用
<option value="${fr.getString("id")}">${fr.getString("userRealName")}</option>
</c:forEach>
</select>
<input id="fillerName" name="fillerName" type="text" style="display: none;"/>
</td>
@RequestMapping(value = "/yszzjg", method = RequestMethod.GET)
@ResponseBody
public ModelAndView BudgetOrganizationGet(HttpServletRequest request) {
ModelAndView mv = new ModelAndView("/BasicSetting/yszzjg");
String sql = "SELECT id,userRealName FROM REF_Users";
DataTable ut = SqlM.execDt(sql);
mv.addObject("ut",ut);
mv.addObject("ft",ut);
return mv;
} 展开
后台框架用的spring mvc
<td>负责人:</td>
<td>
<select id="dutyerID" name="dutyerID" style="width:205px;height:23px;">
<option></option>
<c:forEach var="ur" items="${ut.getRows()}">//可用
<option value="${ur.getString("id")}">${ur.getString("userRealName")}</option>
</c:forEach>
</select>
</td>
<td>填报人:</td>
<td>
<select id="fillerId" name="fillerId" style="width:205px;height:23px;">
<option></option>
<c:forEach var="fr" items="${ut.getRows()}">//不可用
<option value="${fr.getString("id")}">${fr.getString("userRealName")}</option>
</c:forEach>
</select>
<input id="fillerName" name="fillerName" type="text" style="display: none;"/>
</td>
@RequestMapping(value = "/yszzjg", method = RequestMethod.GET)
@ResponseBody
public ModelAndView BudgetOrganizationGet(HttpServletRequest request) {
ModelAndView mv = new ModelAndView("/BasicSetting/yszzjg");
String sql = "SELECT id,userRealName FROM REF_Users";
DataTable ut = SqlM.execDt(sql);
mv.addObject("ut",ut);
mv.addObject("ft",ut);
return mv;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询