Announcement Announcement Module
No announcement yet.
Redirect instead Forward Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Redirect instead Forward


    I have a controller which perform forward action with Model

    public class DirectSigninController  extends AbstractController {
    protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
                throws Exception {
            Map model = new HashMap();
            return new ModelAndView("forward:home.s2",model);
    The fact I am using forward , cause the original URL remains intact.
    which later leads to unexpected behavior if the user refresh the browser

    e.g., lets say the original URL is (this use the above controller):

    after the forward action at the end of the controller the user actioally forward to home.s2 (as expected) page while the original URL stays in the bar,
    so if the user use F5 key to refresh the page he actially runs again the original request while he is on home.s2 page.

    Using redirect to change also the URL is impossible cause I can't send session parameters which required by the home.s2,

    One of the options I tought about was to use the redirect and build the URL parameters string for it, but it is not trivial.

    Is there any other option? what is the right way to overcome such problem?


  • #2