I’ll put two methods of a controller containing the most common ways to do this.
In code it would be something along those lines:
@Controller
public class MainController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView getdata() {
List<String> list = getList();
//return back to index.jsp
ModelAndView model = new ModelAndView("index");
model.addObject("lists", list);
return model;
}
@RequestMapping(value = "/listagem", method = RequestMethod.GET)
public String listagem() {
return "listagem";
}
}
In your controller’s Return it is only by the jsp name you want it to be called. Check this page here: http://www.caelum.com.br/apostila-java-web/spring-mvc/#11-5-a-logica-ola-mundo
– Math
My answer managed to help you?
– Leonardo Villela