[stringtemplate-interest] A plan/idea - seeking thoughts and so forth

Sam Barnett-Cormack s.barnett-cormack at lancaster.ac.uk
Thu Jun 16 09:33:15 PDT 2011


So, I'm thinking about starting a fairly substantial project with 
StringTemplate. Initially, my use for it is internal (for developing 
websites/webapps), but I'm hoping to make it more generally useful.

Basically, I want to develop java-driven websites (using Java EE, of 
course), but as I want to produce extensive and flexible templatisation, 
I don't want to use Facelets or JSP. My plan is to effectively put 
together a servlet, some EJP and some utility classes that enable the 
use of StringTemplate flexibly as a web presentation layer - not writing 
a single website that uses it and has some dynamic elements, but 
actually having run-time decisions about what template to use where, and 
basically having a flexible structure (similar-ish to Drupal templates, 
in essence, but not in detail) for the presentation layer that can be 
played with somewhat independently of the business logic or the glue. 
Obviously, individual projects using this structure would have to supply 
their templates, but each could then be extended with modules providing 
their own models and their own templates, so it would be switching in 
templates as needed.

I could go into more detail, but my brain isn't up to it right now. What 
I'd like to hear from people, if I can, is whether there are existing 
examples of this, and generally what people's thoughts are on pitfalls 
and possibilities.

On a very specific note, though, as I work out some implementation 
details that I need to know (at least whether they are possible) before 
I go further - is it possible in ST4, to have a STGroup (created 
however) and add templates to it at run-time? I imagine I'll be wanting 
to dynamically construct a group based on configuration, using files in 
all sorts of places and possibly pulling things in from arbitrary data 
sources (DBs, remote filesystems, black boxes even). The API docs list 
functions that look like this might be possible, but the lack of any 
description on them makes it hard to tell. Can anyone (Terence, for 
example) tell me if this is possible, and which methods to use for it?

Thanks for any answers and feedback people can give,

Sam


More information about the stringtemplate-interest mailing list