[stringtemplate-interest] StringTemplate and ability to compose a view

Terence Parr parrt at cs.usfca.edu
Thu Jan 13 17:02:50 PST 2011


Hi. Asking the template to delegate control back to the controller makes the template part of the program, in my view, so probably not a good idea. The way I look at things, you push a button dated the templates, and then they render. done.  So, you can apply the menu box template to some data or simply include it, but you can't ask the model to start up again per se. Now, you could pass in an object whose toString method is the menu box [bad] ;)

Ter

On Jan 13, 2011, at 9:25 AM, Jevgenij [GMail] wrote:

> Greetings,
> We have been looking at different templating engines and ST is one of
> the most pure and very interesting.
> Going from an jsp-spaghetti-hell, ST feels like a breath of fresh air.
> 
> We have an interesting use case, which I am unable to find a way to
> implement in ST:
> A html use case, the view looks something like this:
> <body>
> <jsp:include page="servlet?action=showMenu" flush="true" />
> <!-- Render main content -->
> </body>
> 
> The interesting bit is jsp:include call, which goes back to the
> controller, the controller then produces output for the menu.
> The output is dynamic, with request specific logic, (locale,
> authentication, etc....)
> 
> I was trying to find in ST something like a "macro" call, that would
> delegate control back to the controller,
> but was unable to find it. Something in the lines of $#MenuBox()$
> invokes: class MenuBox implements STMacro.
> 
> Maybe we are approaching this from the wrong angle.
> 
> How would you implement something equivalent in ST?
> 
> Regards,
> JT
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest



More information about the stringtemplate-interest mailing list