commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lowe <mel...@gmail.com>
Subject Re: [el] using el as a simple templating engine
Date Thu, 28 Oct 2004 19:54:31 GMT
Thanks for the input Jason

I'm not at all opposed to using jelly for a templating engine for
merging a bean/map to a template.. The problem i'm trying to solve is
parsing a template into a admin form..

There are a few problems such as where to store the meta data such as
size of a text field and such like, and thus my mind as natururally
moving towards a xml/xsl solution. That or i create my forms from the
model and just use the templates to render the output, which does seem
more sensible, and thus you solution could well be ideal.

I'll have a longer think on it.. 

Mark

On Thu, 28 Oct 2004 11:18:41 +1300, Jason Lea <jason@kumachan.net.nz> wrote:
> Mark Lowe wrote:
> 
> 
> 
> >Hello
> >
> >I've been looking at the EL api and I'm wondering if it can be used
> >like folk use velocity, for email templates and such like.
> >
> >Does EL lend itself well to this? or was it onlt made as something to
> >be parsed and then compiled?
> >
> >Any wikis to get me going would be appeciated.
> >
> >Mark
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> >
> >
> >
> I use Jelly for email templates.  So that I can use the same EL
> language/system I use with JSPs in developing HTML/plain text email
> templates.
> Found that you can embed Jelly in your code using the following:
> 
>         ByteArrayOutputStream os = new ByteArrayOutputStream();
> 
>         Embedded embedded = new Embedded();
>         embedded.setOutputStream(os);
>         embedded.setVariable("user", user);
>         embedded.setVariable("searchList", searchList);
>         embedded.setVariable("results", results);
> 
> embedded.setScript(Global.loadResource("resources/alert-html.jelly"));
> 
>         boolean bStatus = embedded.execute();
> 
>         if (!bStatus) {
>             String errorMsg = embedded.getErrorMsg();
>             log.error("Error in jelly: "+errorMsg);
>         }
>         return os.toString();
> 
> in the jelly script you can use the normal ${user.name} etc from the
> variables I stored above
> 
> --
> Jason Lea
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message