I have a Spring MVC web form built using JAVA Spring MVC (Backend) and AngularJS (frontend), JSP(for view) and MySQL DB. A user is able to submit the form after filling it out and search an existing entry. An email is also sent out to the user once the entry has been submitted. The entry also gets saved on a database. In the email body, I am trying to have a link which redirects the user to the form populated with the entries corresponding to the given id..the same way as when the search button is clicked..the form gets populated with the existing form fields..
Currently I wrote a controller which returns the JSP page with the data (searchData)..using ModelAndView however.. it is not populating the form with the details of the entry. How can I achieve this functionality?
I wrote the below code for the controller
@RequestMapping(value = "/searchById", method = RequestMethod.GET)
public ModelAndView populateEntrydata(@RequestParam(value = "id") String id) {
String url= "http://localhost:8080/myform/searchById?id=" + id;
ModelAndView model = new ModelAndView("index"); //jsp page
ResponseEntity<Data> searchData = search(id);
model.addObject("searchById", searchData);
// String, String, object
return model;
}
How can I access the model object in the angularJS controller so I can populate the jsp with the contents i receive from the ModelAndView?