I have the following code. I want to access booleanValueObj on nextPage.jsp. How is this done? The object is not always available to nextPage() method on every request, so a requestParam seems like it’s not appropriate.
@RequestMapping(method=RequestMethod.POST)
public ModelAndView sendEmail()
{
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject(booleanValueObj, true);
modelAndView.setViewName("redirect: /nextPageClass");
return modelAndView;
}
@RequestMapping("/nextPageClass")
public class NextPageController
{
@RequestMapping(method = RequestMethod.GET)
public ModelAndView nextPage()
{
ModelAndView modelAndView = new ModelAndView("/nextPage");
return modelAndView;
}
}
You can’t pass booleanValueObj to a redirected page. If booleanValueObj is simply a boolean value, it seems appropriate to be passed to /nextPageClass thru the request parameters.