[Yanel-dev] Using Jelly
Evaldas Taroza
etaroza at optaros.com
Mon Apr 7 00:42:23 CEST 2008
Michael Wechner wrote:
> Hi
>
> I am currently refactoring some third party resource class which is
> using Jelly and I would like to use the resource itself within the Jelly
> files, so I set within the resource
>
> jellyContext.setVariable("resource", this);
>
> and the use it within the Jelly as follows
>
> <p>${resource.getFoo()}</p>
>
> but somehow it does nothing, whereas the method getFoo() exists and
> compiles correctly.
>
> Any idea what might be wrong?
It should work. Check if you don't have any syntactic mistakes in the Jelly.
By the way. I always thought that exposing the "resource" to the Jelly
is not very nice. The jelly should only be concerned with what is
intended for it. As a template it should only know about the model (of
the view) because it is supposed to be used for rendering.
When you start having ${resource.getFoo()}, ${resource.setFoo()} etc.
then the template becomes kind of an active entity, a controller. Hence
the same story as with JSP, where you mix view and controller.
Evaldas
--
+41 79 616 53 76
www.linkedin.com/in/taroza
Optaros - www.optaros.com
More information about the Yanel-development
mailing list