0

I have a form with post method and on submit it redirects to other page.
But after submitting and displaying the result page when I press the back button it displays the blank browser screen with error message to confirm form re-submission.
I know on reload the popup to re submit form appears but can't understand why I'm getting the blank page. Any help will really be appreciated.

Here are my controllers:

    @ResponseBody
@RequestMapping(value="/pax-details-redirect", method=RequestMethod.POST)
public ModelAndView getPaxDetails(HttpServletRequest request,ModelMap modelMap){
    String selectedOptionKey = request.getParameter("selectedOption");
    selectedOptionModelOneWay = TravelportUtil.getSelectedOptionModel(asynchRspOneWay, selectedOptionKey, numberOfAdult, numberOfChildren, numberOfInfant);
    modelMap.addAttribute("selectedOptionModelOneWayDetails", selectedOptionModelOneWay);
    modelMap.addAttribute("selectedOptionModelOneWaySession", selectedOptionModelOneWay);
    return new ModelAndView("pax_details_form");
}

@ResponseBody
@RequestMapping(value="/pax-details", method=RequestMethod.POST)
public ModelAndView getPaxDetails(@ModelAttribute("selectedOptionModelOneWayDetails") DisplayOptionModel displayOptionPaxDetailsModel,
        @ModelAttribute("selectedOptionModelOneWaySession")  DisplayOptionModel displayOptionSessionModel,ModelMap modelMap){
    displayOptionSessionModel.getTravelersList().addAll(displayOptionPaxDetailsModel.getTravelersList());
    modelMap.addAttribute("selectedOptionModelOneWaySession",displayOptionSessionModel);
    return new ModelAndView("review_pax_and_flight");
}

Thank You.

Yadvendra
  • 27
  • 1
  • 9
  • The page is blank because you need to confirm form resubmission, unless you agree the page won't reload. Is this what you're asking? – kryger May 20 '16 at 13:09
  • Redirect after the post, currently you are forwarding. This is called the post-redirect-get pattern. – M. Deinum May 20 '16 at 18:22

1 Answers1

0


I don't know why but the root cause of problem I found is shocking. Maybe there could be a logical reason.
But if I use a session attribute using @SessionAttribute annotation the issue occurs, and if I remove that attribute the process works as expected.

Yadvendra
  • 27
  • 1
  • 9