[Web-SIG] Standardized template API

Alan Kennedy pywebsig at xhaus.com
Tue Jan 31 23:02:26 CET 2006


[Clark C. Evans]
> I'd stick with the notion of a "template_name" that is neither the
> template file nor the template body.  Then you'd want a template factory
> method that takes the name and produces the template body (complied if
> necessary).  

I agree.

If you're looking for an existing model (in java), the Spring framework 
has "View" objects (i.e. the V in MVC) and "View Resolver" objects. The 
latter resolve logical template names to actual templates, compiled if 
necessary.

View Interface
http://static.springframework.org/spring/docs/1.2.x/api/org/springframework/web/servlet/View.html

ViewResovler Interface
http://static.springframework.org/spring/docs/1.2.x/api/org/springframework/web/servlet/ViewResolver.html

> This way your template could be stored
> in-memory, on-disk, or in a database, or even remotely using an HTTP
> cashe.  The actual storage mechanism for the template source code should
> not be part of this interface.

A very important requirement IMHO.

Regards,

Alan.



More information about the Web-SIG mailing list