嗨我正在尝试在jsp中打印arraylist的内容 这是控制器代码
@RequestMapping(value = "/deleteFilter", method = RequestMethod.GET)
public String deleteFilter(FilterValues filterData,ModelMap modalMap) {
logger.info("delete a filter");
ArrayList<String> filtername= mongoService.getTargetFiltersName();
modalMap.addAttribute("filterslist", filtername);
return "delete";
}
这里是jsp的一部分,我必须打印它
<div class="col-xs-4">
<label for="pwd">Filter Name:</label>
<select type="Filter Name" class="form-control" id="pwd" placeholder="Enter Filter Name">
<c:forEach items="${filterslist}" var="filtername">
<option value="${filtername.value}">${filtername.value}</option>
</c:forEach>
</select>
</div>
它给我的错误
提前致谢
答案 0 :(得分:0)
我认为您应该使用以下代码,因为您正在ArrayList
String
上进行迭代
<div class="col-xs-4">
<label for="pwd">Filter Name:</label>
<select type="Filter Name" class="form-control" id="pwd" placeholder="Enter Filter Name">
<c:forEach items="${filterslist}" var="filtername">
<option value="${filtername}">${filtername}</option>
</c:forEach>
</select>
</div>