Announcement Announcement Module
Collapse
No announcement yet.
Redirecting to an arbitrary location: How? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Redirecting to an arbitrary location: How?

    Hello everyone,

    For redirecting to pre-defined locations from my controller I can use the RedirectView - that is fine.

    But how can I redirect to an arbitrary location?

    I consider using
    Code:
    response.sendRedirect(arbitraryLocation);
    return null;
    as a bad practice, especially since I have to handle the IOException...

    Regards,

    Andreas

  • #2
    ModelAndView has a constructor that takes a View, rather than a logical view name. So why not return a ModelAndView with a new instance of RedirectView with your arbitrary view name? RedirectView has very little instance data, so the cost of object creation will be negligible.

    Rgds
    Rod

    Comment

    Working...
    X