1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| package cn.idea360.jsp.controller;
import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView;
import java.text.DateFormat; import java.util.Date;
@Controller public class IndexController {
@RequestMapping("/") public ModelAndView hello(Model m) { ModelAndView hello = new ModelAndView("index"); hello.addObject("now", DateFormat.getDateTimeInstance().format(new Date())); return hello; }
}
|