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

  • Controller to Controller

    Hi
    Can anybody here help me forwarding a request in one controlloer to another controller?

    cheers
    Prins

  • #2
    You can call the handleRequest method on any controller:

    Code:
    public class ... extends AbstractController {
        private Controller someController = null;
    
        public void setSomeController(Controller ctrl) {
            this.someController = ctrl;
        }
    
        protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
            return this.someController.handleRequest(request, response);
        }
    }
    There may be conflicts when setting different caching semantics in these two controllers although that is probably unusual in most applications.

    Comment


    • #3
      Ok, not 100% sure of this, but may aim is to do: when i am preparing to show a formView (ControllerPage1.jsp) (as a property of Controller1) and i it doesnt fulfill the conditions and thus i want to pass it to Controller2 and let Controller2 show its formView(ControllerPage2.jsp).
      Dont know if you know what im meaning

      cheers
      Prins

      Comment


      • #4
        Originally posted by prinsinn
        Ok, not 100% sure of this, but may aim is to do: when i am preparing to show a formView (ControllerPage1.jsp) (as a property of Controller1) and i it doesnt fulfill the conditions and thus i want to pass it to Controller2 and let Controller2 show its formView(ControllerPage2.jsp).
        Dont know if you know what im meaning

        cheers
        Prins
        You need an org.springframework.web.servlet.view.InternalResou rceView

        Bob

        Comment


        • #5
          Ok, now we are getting somewhere devijvers, now im able to redirect from controller1 to controller2, display controller2īs view, but when i submit in controller2 i get the request/onsubmit action into controller1!
          Any clue?

          cheers
          Prins

          Comment

          Working...
          X