Announcement Announcement Module
Collapse
No announcement yet.
customising RedirectView Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • customising RedirectView

    Hi,

    In section 13.5.3.2 of the Spring manual, it advises against creating instances of RedirectView directly in the controller like this:

    Code:
    View redirectView = new RedirectView("http://example.org");
    return new ModelAndView(redirectView);
    and suggests instead to use something like the following:

    Code:
    return new ModelAndView("redirect:http://example.org");
    (Ideally, the URL should be injected into the controller, rather than a hard-coded String literal, as above). However, one advantage of the first approach is that I can easily customise the redirection, for example by calling one of the following methods
    • RedirectView.setContextRelative()
    • RedirectView.setExposeModelAttributes()

    Is it possible to perform the same customisation when using the second (recommended) approach?

    Thanks in advance,
    DM
Working...
X