I'm +1 for placing the Velocity interface utility
into the util package.

Still it needs some more fixes (e.g. adding the posibility
to send strings as parameters when calling VMs). 

I implemented the missing body of the parseTemplate() method,
patch is included below. Please ingest...

Geir, I could use the eval directive you said you have ready,
could you please either include it as a sample pluggable 
directive or send it to me directly.

Instead of a diff -u I'm sending the method only. Also needs a
import org.apache.velocity.Template;
----------------------------------------------------------------
    /**
     *  Parses a template and returns the rendered stream into the writer
     */
    public static boolean parseTemplate( String templateName, Context context, Writer 
writer )
    {
        try
        {
            Template template = Runtime.getTemplate(templateName);

            if ( template == null )
                Runtime.error("Velocity.parseTemplate() failed loading template '" + 
templateName + "'" );
            else
                template.merge(context, writer);

            return true;
        }
        catch( Exception e )
        {
            Runtime.error("Velocity.parseTemplate() with " + templateName + " : " + e 
);
        }

        return false;
    }

}
----------------------------------------------------------------

:) Christoph

Reply via email to