1.读取数据库中的记录List> attributes;
2.Controller构造Model如下:
@RequestMapping("display.do")
public ModelAndView display(HttpServletRequest request, ModelMap model) {
List> myList = disService.getAllRecords();
model.addAttribute("list", myList);
/*此处可追加Attribute*/
return new ModelAndView("display.jsp");
}
3.display.jsp使用内嵌java显示记录
页面引入类
获取list
List> list = (List>)request.getAttribute("list");
%>
以table形式显示数据
value1 | value2 | value3 |