springmvc框架里用controller传list到jsp页面,但是用c:foreach显示不出来,在线等,急
这是controller里代码@RequestMapping("/lookboard")publicStringlookboard(HttpSessionsession,...
这是controller里代码
@RequestMapping("/lookboard")
public String lookboard(HttpSession session,Model model)
{
LookmsgService ls=new LookmsgService();
List<BoardMsg> bmsg=ls.lookmsgboard();
System.out.println(bmsg);
model.addAttribute("bmsg", bmsg);
//System.out.println("incontroller:"+rd.getName());
return "/reader/board/lookboard";
}
这是jsp里的代码
<table>
<tbody>
<c:forEach items="${bmsg}" var="record" begin="0" varStatus="status">
<tr>
<td>${record.uno}</td>
<td>${record.msgcontent}</td>
<td><a href="deleMessage?uno=${record.uno}&msgcontent=${record.msgcontent}">删除</a></td>
</tr>
</c:forEach>
</tbody>
</table> 展开
@RequestMapping("/lookboard")
public String lookboard(HttpSession session,Model model)
{
LookmsgService ls=new LookmsgService();
List<BoardMsg> bmsg=ls.lookmsgboard();
System.out.println(bmsg);
model.addAttribute("bmsg", bmsg);
//System.out.println("incontroller:"+rd.getName());
return "/reader/board/lookboard";
}
这是jsp里的代码
<table>
<tbody>
<c:forEach items="${bmsg}" var="record" begin="0" varStatus="status">
<tr>
<td>${record.uno}</td>
<td>${record.msgcontent}</td>
<td><a href="deleMessage?uno=${record.uno}&msgcontent=${record.msgcontent}">删除</a></td>
</tr>
</c:forEach>
</tbody>
</table> 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏15(财富值+成长值)
展开全部
@RequestMapping("/lookboard")
public ModelAndView lookboard()
{
ModelAndView model = new ModelAndView("/reader/board/lookboard");
LookmsgService ls=new LookmsgService();
List<BoardMsg> bmsg=ls.lookmsgboard();
System.out.println(bmsg);
model.addAttribute("bmsg", bmsg);
//System.out.println("incontroller:"+rd.getName());
return model;
}
public ModelAndView lookboard()
{
ModelAndView model = new ModelAndView("/reader/board/lookboard");
LookmsgService ls=new LookmsgService();
List<BoardMsg> bmsg=ls.lookmsgboard();
System.out.println(bmsg);
model.addAttribute("bmsg", bmsg);
//System.out.println("incontroller:"+rd.getName());
return model;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询