velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nick Temple" <>
Subject Render "tool"
Date Thu, 08 Aug 2002 08:25:12 GMT
Geir --

Thanks for the (multiple) tips on the render / execute "tool" - reading the list helped solve
a problem I didn't know I had. The following code snippet works anyplace I have access to
the context::

  context.put("velocotityengine", ve);
  public String render(String templatePath) throws Exception {
     VelocityEngine ve = (VelocityEngine) context.get("velocityengine");
     StringWriter sw = new StringWriter();
     Template t = ve.getTemplate( templatePath );
     t.merge( context, sw );
     return sw.toString();

I also have  tool that will render nearly any single-level JSP tag [specifically activeedit
from] It doesn't handle
nested tags, ie, <jsp:tag1> .... <jsp:tag2 /> ... </jsp:tag1> ...  at that
point your pretty much stuck with a JSP include ... I was pointed to some code to do that
in the Webwork framework.

I'll be packaging some of this stuff up later to contribute, assuming there is interest. 
Is there?

One thing I did run into is no "standard" to create velocity tools.  Would it be worthwhile
to create a (minimal) VelocityTool interface that can be implemented / extended by various
frameworks to use off-the shelf tools? Or is there one available that I missed?


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message