Announcement Announcement Module
Collapse
No announcement yet.
redirect: prefix and view resolver Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • redirect: prefix and view resolver

    I tried out the redirect: prefix support in Spring 1.1.2 and noticed that it does not resolve using logical view names but rather requires the resolved view name to be provided after the prefix.

    For example the following does not resolve the redirect success view to addUser.do

    Code:
    <bean id="addUserForm" class="com.foo.AddUserForm">
    ...
    <property name="formView">
    <value>addUser</value>
    </property>
    <property name="successView">
    <value>redirect&#58;addUser</value>
    </property>
    I understand that redirects can be used to redirect outside the current web app, but I think that a typical use case (atleast for me) is for redirect within the same app - like redirect after a form submission for reasons like double submit or redirect to the original form so that the user can, say, add another User.

    Could Spring support another prefix such as redirect_internal: that uses the native view resolver ?

    Thanks,
    Sanjiv

  • #2
    Nevermind. I realized that the view resolver would resolved to something like addUser.jsp and not addUser.do which would be what is required in a redirect.

    Comment


    • #3
      I was just thinking the same thing, and your 2nd comment gave me the same lightbulb.

      Still, it seems rather "hardcoded" to have something like this in the controller:

      Code:
      RedirectView rv = new RedirectView&#40;"/" + getSuccessView&#40;&#41; + ".htm"&#41;;
      Maybe some sort of "ExternalUrlResolver" would be appropriate?

      Comment

      Working...
      X