@RequestMapping("/list")
public ModelAndView list() {
ModelAndView view = new ModelAndView("list");
List<Task> tasks = taskService.createTaskQuery().list();
view.addObject("tasks", tasks);
view.addObject("message", "This is a message.");
return view;
}
@RequestMapping("/list1")
public String list(Model view) {
List<Task> tasks = taskService.createTaskQuery().list();
view.addAttribute("tasks", tasks);
view.addAttribute("message", "This is a message.");
return "list";
}
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
<head>
<title></title>
</head>
<body>
${tasks}
</body>
</html>
分享到:
评论