My question has to do with populating a bootstrap modal with model information from Spring MVC. Specifically, since the modal activation button does not "hit" a new url, but only activates the modal on the existing page, how do I call the controller method to populate the model with the required information?
Additionally, how do I return the populated model in such a way that the user remains on the current page and the modal itself remains open (page is not reloaded)?
I am trying to create a time sheet application and would like to use a modal to display a list of work items that a user can add to his or her time sheet. I would also like to include a search function on the modal as well, which will mean aditional calls to the controller that require the model to be updated without reloading the whole page.
My current controller methods are of the form:
// Browser must hit his specific URL
@RequestMapping(value = "/timeSheets", params = { "weekOf" })
public ModelAndView getTimeSheetForWeek(@RequestParam(value = "weekOf") String weekOf) {
// convert date string and get info from DB
timeSheet = ...;
// populate the model
model.addAttribute("timeSheet", timeSheet);
// return using a ModelAndView object (redirect/page reload)
return new ModelAndView(TIME_SHEET_DETAILS_URL, model);
}
Has anyone done something like this before? I have experience working with bootstrap and spring MVC, but not quite at this level.
Thank you very much.