I'd better use (and in fact I do use) some other template engine for
emails. Would be much easier for everything (including plain-text emails,
for example). My choice is FreeMarker, but Velocity is equally good.

You can easily implement a service that encapsulates all template
operations. You may save your templates to normal package hierarchy under
'resources'. Below is an example from my project. Hope that helps!

        fmConfig.setClassForTemplateLoading ( getClass(),
"/package/name/for/templates" );

        fmConfig.setObjectWrapper ( ObjectWrapper.DEFAULT_WRAPPER );


    @Override

    public String render ( String templateName, Map<?, ?> parameters,
Locale locale ) {

        try {

            logger.info ( "rendering template: " + templateName + " for
locale " + locale );

            Template template = fmConfig.getTemplate ( templateName + ".ftl",
locale, "UTF-8" );

            StringWriter writer = new StringWriter ();

            template.process ( parameters, writer );

            return writer.toString ();

        } catch ( IOException e ) {

            throw new RuntimeException ( e );

        } catch ( TemplateException e ) {

            throw new RuntimeException ( e );

        }

    }




On Wed, Jun 11, 2014 at 5:20 PM, Boris Horvat <horvat.z.bo...@gmail.com>
wrote:

> Hi everyone,
>
> I was wondering would it be possible to create a page (i.e. tml and java
> code) and then sending that data to the database on certain event.
> basically using tapestry as a template mechanism
>
> Can I serve row output of the page somehow? In other words to force
> tapestry to compile html for a given page and then redirecting that output
> to the database?
>
> Does anyone know any such examples?
>
> Cheers
>
> --
> Sincerely
> *Boris Horvat*
>



-- 
Ilya Obshadko

Reply via email to