Hello,
I'm trying to complete that tutorial with annotated controllers. I got stuck on the Step 2. Here is what they have for Simple Controllers:
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String now = (new Date()).toString();
logger.info("Returning hello view with " + now);
return new ModelAndView("WEB-INF/jsp/hello.jsp", "now", now);
}
I tried to replace it with
@RequestMapping(method = RequestMethod.GET)
public String showUserForm(ModelMap model)
{
String now = (new Date()).toString();
logger.info("Returning hello view with " + now);
model.addAttribute("now", now);
return "WEB-INF/jsp/hello.jsp";
}
But that parameter "now" is not read in hello.jsp (it could be accessed by the first link, I can't paste html here).
How can I transfer that parameter to hello.jsp?
Thanks!