tags:

views:

25

answers:

1

Hi, do you know if there's an equivalent in Grails to ASP.NET MVC's Html.RenderAction also found in Ruby on Rails as Cells?

The basic idea is that you can render something but the decision what to render is passed on to a different controller. So for example if you have a shopping cart's preview on the page that it's not taken from the current controller nor from data stored in session but from a result of another action in another controller (say ShoppingCartController).

Thanks.

+2  A: 

I found it! It's called "include plugin". You install it like any other plugin and than you have the option to say:

<inc:include controller="shoppingCart" action="preview"/>

and it does exactly what it's supposed to do: render the outcome of preview action on ShoppingCartController.

Matthias Hryniszak
Alternatives to the plugin:Make use of GSP templates to "include" a portion of content from another controller:[http://www.grails.org/doc/latest/guide/6.%20The%20Web%20Layer.html#6.2.3%20Views%20and%20Templates]Use the <g:include/> tag:[http://www.grails.org/doc/latest/ref/Tags/include.html]
Matt Lachman
Thank you! That should have been the answer :D the g:include tag is what I've been looking for and it's in the base set of tags! Extraordinary!!!
Matthias Hryniszak