The scenario is: I want to show a list of items on my view from the database. My controller picks up the data, passes it to the view which displays it. I am using a sub class of org.springframework.web.servlet.mvc.SimpleFormController:
@Override
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
ModelAndView view = new ModelAndView("complaintListings");
List
strings.add("AAAAAAAA");
strings.add("BBBBBBB");
strings.add("CCCCCCCC");
strings.add("EEEEEEEE");
strings.add("FFFFFFFFF");
//set the object to view
view.addObject("testStrings", strings);
return view;
}
The view looks like this:
Its that simple!