I\'m trying to retrieve the user information from DB and display in the front end (JSP) using Spring MVC.
Inside the controller, currently I\'m adding the following cod
In controller add as below
ModelMap model = new ModelMap();
model.put("user", user);
In jsp use like this
${user.name}
Or there is another option - to use @ModelAttribute like this: http://krams915.blogspot.com/2010/12/spring-3-mvc-using-modelattribute-in.html (contains Model and ModelAttribute examples).
Don't forget the JSP option isELIgnored="false"
as below:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" isELIgnored="false"
pageEncoding="ISO-8859-1"%>
**In Controller do IT**
@RequestMapping(value = "/loginStep.do", method = RequestMethod.GET)
public String loginStep(ModelMap model,HttpServletRequest request, HttpServletResponse response,HttpSession session) {
model.addAttribute("YearList", yearList);
return "uploadPDFPage";
}
**In uploadPDFPage JSP Do it**
${YearList}