Spring MVC Controller
@Controller
public class OrderController {
private static final Logger logger = LoggerFactory.getLogger(OrderController.class);
@RequestMapping(value = "/report", method=RequestMethod.GET)
public String adForm(Model model) {
model.addAttribute("startTime", "Start Time");
model.addAttribute("endTime", "End Time");
return "home";
}
@RequestMapping(value = "/result", method=RequestMethod.GET)
public String makeReport(@RequestParam("startTime") int startTime,
@RequestParam("endTime") int endTime, Model model) {
logger.info("Displaying Page is AD");
List<AdDao> data = (new SelectAdByDate().findFromAdByDate(startTime, endTime));
model.addAttribute("data", data);
return "result";
}
}
View
1. home.jsp
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="false" %>
<html>
<head>
<title>Home</title>
</head>
<body>
<h1>
AJAX JSON Example
</h1>
<P> The time on the server is ${serverTime}. </P>
<form action="result" method="get">
<P> Start Time
<input type="text" name="startTime" value="20130728"/>
</P>
<P> End Time
<input type="text" name="endTime" value="20130801"/>
</P>
<input type="submit" value="result" onclick="result"/>
</form>
</body>
</html>
2. result.jsp
<!-- Use this for the 'form' tag -->
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ page session="false" %>
<html>
<head>
</head>
<body onload="loadChart(${data})">
<script type="text/javascript">
var chart1;
function loadChart(data) {
내용
};
</script>
</body>
</html>
참조: http://snoopy81.tistory.com/314
http://blog.naver.com/PostView.nhn?blogId=fourleaf0311&logNo=140117091984&categoryNo=0&parentCategoryNo=0&viewDate=¤tPage=1&postListTopCurrentPage=1&userTopListOpen=true&userTopListCount=30&userTopListManageOpen=false&userTopListCurrentPage=1
http://springsource.tistory.com/13
http://arawn.github.io/blog/2012/03/17/at-modelattributeyi-sseuimsaeneun-mueosingo/
http://www.kunner.com/997
http://blog.daum.net/aswip/8429416
댓글 없음:
댓글 쓰기