Announcement Announcement Module
Collapse
No announcement yet.
return new ModelAndView("redirect: Is Request maintained? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • return new ModelAndView("redirect: Is Request maintained?

    Hi,
    I have one very basic question,
    when we say
    Code:
    return new ModelAndView("redirect:/product.jsp");
    Will the beans/values stored at request level be available in product.jsp?

    The situation that made me think about this
    Dynamo JHTML has a functionality that allows you to send a specific action to a DynamoServlet's userdefinedmethod e.g. handleReport by specifying <input type=submit bean="servletname:methodname" ....... and rest all submit will go to action defined in <form action="target">.

    While migrating from ATG Dynamo to Spring, I tried achieving the same functionality by submitting all the actions to a particular controller and then in that controller i will decide if this request is special request, then directly say return new ModelAndView("redirect"..... so the question..... will it maintain the request variables?
    Thanks.

  • #2
    Resolved

    Answered. Created a small application and tried simulating my scenario.
    Answer is NO, it DOES NOT maintain the request while doing return new ModelAndView("redirect:"......

    But the question that comes to my mind is, is there anything else other than "redirect:" like "forward:" or anything else?

    Comment


    • #3
      Originally posted by Dhyanesh View Post
      Answered. Created a small application and tried simulating my scenario.
      Answer is NO, it DOES NOT maintain the request while doing return new ModelAndView("redirect:"......
      If you use RedirectView to perform the redirect you can use the method setExposeModelAttributes() to control whether the request attributes are exposed.

      Originally posted by Dhyanesh View Post
      But the question that comes to my mind is, is there anything else other than "redirect:" like "forward:" or anything else?
      Not sure what exactly you're asking here, you can use
      Code:
      new ModelAndView("forward:http://www.example.org")
      to do a forward

      Comment

      Working...
      X