Will start with FreeMarker and work our way down :) Thank you everyone with quick answers
On Wed, Jun 11, 2014 at 4:32 PM, Dmitry Gusev <dmitry.gu...@gmail.com> wrote: > I agree with Ilya, > it may be easier to use some template engine for this. > > For example, we're using StringTemplate. > > The only issue when using external template engine is creating URLs to the > application, because you may be sending emails out of web request scope > and LinkSourceImpl won't work without request. We ended with implementing > our own OfflineLinkSource for this purpose. > > > On Wed, Jun 11, 2014 at 5:46 PM, Ilya Obshadko <ilya.obsha...@gmail.com> > wrote: > > > 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 > > > > > > -- > Dmitry Gusev > > AnjLab Team > http://anjlab.com > -- Sincerely *Boris Horvat*