Results 1 to 3 of 3

Thread: Controller calling another Controller

Hybrid View

  1. #1

    Default Controller calling another Controller

    Hi Experts,

    Can you please help me how can a Controller call another Controller?
    And passing HttpServletRequest and ModelAttribute?

    Thank you very much,

  2. #2

    Default

    I already solved this one:

    In Controller A:

    request.setAttribute("element", elementData);
    mav.setView((new InternalResourceView("/totheNextControlllerURL.do")));
    return mav;

    In Controller B:
    MyElement myElement = (MyElement) request.getAttribute("element");

    This is done!

  3. #3
    Join Date
    Sep 2011
    Posts
    17

    Default

    Hi, another way is:

    ModelAndView mav = new ModelAndView("redirect:/totheNextControlllerURL.do");

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •