Announcement Announcement Module
Collapse
No announcement yet.
MVC - Call controller from View Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MVC - Call controller from View

    In ASP.NET MVC, I can have a View of a Controller which calls another Controller.
    ...
    <div class="side-bar">
    <% Html.RenderAction("Index", "Banner", new { areaId = "side-bar", categoryPath = Request.Path }); %>
    </div>
    ...

    [Banner] is mapped to BannerController.
    [Index] is the action of the controller.
    The third parameter is the parameters to be passed to the controller's action

    The output of the View for BannerController is rendered within the side-bar tag.


    This is very useful for reusing the MVC 'component'.

    Is there any equivalent in Java world?

  • #2
    This feature is of course dependent on the view technology in use. For JSP there's <jsp:include>.
    You can read more about it here: http://java.sun.com/products/jsp/syn...axref1214.html

    HTH

    Comment


    • #3
      I am looking for the similar solution, Struts2 has 'action' tag for this.
      How can this be implemented in spring mvc, any ideas?

      Comment

      Working...
      X