I am having some trouble moving objects rendered to a jsp from a controller to another jsp. The data to be displayed is part of the data in the first jsp. The flow goes like this :
Welcome.jsp (contains a hyperlink)--->invokes a controller(http get) which takes student data(name, mobile no,subject) in a jsp (admissionForm.jsp) --->on submitting form(http post)-->displays the data on admissionSuccess.jsp. this jsp contains a hyperlink(http get) which should display only the student name and mobile number(requestForm.jsp). This page contains other features like submitting a service request (to be implemented).
I am using Spring 3.x with ModelAndView controller. The closest answer I got was to use @SessionAttribute but that came with Model object. Can anyone assist on this ?
My code is as follows :
@RequestMapping(value="/submitAdmissionForm.html", method=RequestMethod.POST)
public ModelAndView submitAdmissionForm(@Valid @ModelAttribute("student1") Student student1, BindingResult result,HttpServletRequest request,
SessionStatus status)
if(result.hasErrors())
{
ModelAndView model1 =new ModelAndView("AdmissionForm");
return model1;
}
ModelAndView model1 =new ModelAndView("AdmissionSuccess");
model1.addObject("student1", student1);
return model1;
@RequestMapping(value="/getRequestForm.html", method=RequestMethod.GET)
public ModelAndView getRequestForm( @ModelAttribute("student1") Student student1,BindingResult result)
{
ModelAndView model1 =new ModelAndView("RequestForm");
model1.addObject("student1", student1);
return model1;
}