Announcement Announcement Module
No announcement yet.
forwarding to a controller without RedirectView Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by kbaum
    I was looking at the UrlBasedViewResolver and I noticed that with the release of 1.1.3, Spring now allows server side forwards by specificying the prefix forward: in the view name. As stated in the javadocs:
    sorry not work with ResourceBundleViewResolver


    • #17
      What's the alternative solution when using a ResourceBundleViewResolver then I mean, in a bean file, where you can't use new RedirectView(...)
      Last edited by Chaps; Jul 17th, 2006, 11:32 AM.


      • #18
        I know some cases where a controller chain is a very nice feature. For example:

        An edit view. The data is stored in session. You have a new button which clears the data and shows the edit form.

        In this case chaining controller would be a great benefit.

        NewController (clearing the data) -> EditController (preparing Form) -> EditView

        Without repeating code or configuration the possibilities are rare. One solution would be to subclass the editcontroller but in this case I still have twice as much configuration.

        My solution:

        public abstract class AbstractDelegateController extends AbstractController {
        private String delegateController;

        protected ModelAndView handleRequestInternal(HttpServletRequest request,
        HttpServletResponse response) throws Exception {
        doWork(request, response);
        if (delegateController == null)
        return new ModelAndView();
        return new ModelAndView("forward:" + delegateController);

        protected abstract void doWork(HttpServletRequest request, HttpServletResponse response);

        public void setDelegateController(String delegateController) {
        this.delegateController = delegateController;


        <bean name="/" class="web.controller.NewController">
        <property name="delegateController" value="/"/>