I am working in a Spring MVC application which uses Hibernate.
In the JSP page I have a function which lists the values stored in the database(currently all the val
Use the @RequestParam to pass a parameter to the controller handler method.
In the jsp your form should have an input field with name = "id" like the following:
Then in your controller, your handler method should be like the following:
@RequestMapping("listNotes")
public String listNotes(@RequestParam("id") int id) {
Person person = personService.getCurrentlyAuthenticatedUser();
model.addAttribute("person", new Person());
model.addAttribute("listPersons", this.personService.listPersons());
model.addAttribute("listNotes", this.notesService.listNotesBySectionId(id, person));
return "note";
}
Please also refer to these answers and tutorial: