package jp.co.iterative.bus.backend.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import jp.co.iterative.bus.backend.form.RouteForm;
import jp.co.iterative.bus.entity.RouteCustomized;
import jp.co.iterative.bus.entity.RouteExample;
import jp.co.iterative.bus.mapper.RouteCustomMapper;
@Controller
@RequestMapping("/routeList")
public class RouteListController {
@Autowired
private RouteCustomMapper routeCustomMapper;
@ModelAttribute
public RouteForm creatForm() {
return new RouteForm();
}
@RequestMapping("/index")
public String index(Model model) {
RouteExample routeExample = new RouteExample();
routeExample.setOrderByClause("id");
List<RouteCustomized> routeList = routeCustomMapper.selectByExample(routeExample);
model.addAttribute("routeList", routeList);
//System.out.println("RouteListController");
//System.out.println(routeList.size());
return "route/routeList";
}
@RequestMapping("/search")
public String search(String inputDate, Model model) {
//System.out.println(new Date(inputDate));
List<RouteCustomized> searchList = routeCustomMapper.selectByDate(inputDate);
model.addAttribute("routeList", searchList);
//System.out.println("RouteListController");
//System.out.println(searchList.size());
//System.out.println(searchList.get(0).getFinishName());
return "route/routeList";
}
}
jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jsp/common/define.jsp"%>
<jsp:include page="/WEB-INF/jsp/common/header.jsp"></jsp:include>
あなたの回答
tips
プレビュー