後台代碼:
public ModelAndView selectAllTitle(@ModelAttribute("turnPage") TurnPage turnPage,HttpServletRequest request){
ModelAndView mv = new ModelAndView();
Map paraMap=RequestUtil.getParameterMap(request);
paraMap.put("turnPage", turnPage);
try {
Map resultMap = articleSrv.exuteFindList(paraMap);
List list=(List)resultMap.get("list");
mv.addObject("list", list);
mv.addObject("turnPage", turnPage);
mv.addObject("title", paraMap.get("title"));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mv.setViewName("redirect:/showAllArticle.jsp");
return mv;
}
<c:forEach items="${list}" var="list">
<tr>
<th><c:out value="${list.content}" /></th>
<th><c:out value="${list.name}" /></th>
<th><c:out value="${list.content}" /></th>
<th><c:out value="${list.comment}" /></th>
<th><c:out value="${list.type}" /></th>
<th><a href="#">轉發</th>
</tr>
</c:forEach>
應該要把var裡的名字改一下吧,和前面的item重名貌似不太好