[stringtemplate-interest] use template groups in a WAR
Harry Karadimas
harry.karadimas at hmn.aphp.fr
Mon Nov 13 04:45:49 PST 2006
Put your files in /WEB-INF/classes, and try "/" in front of your path, e.g.
*/*skins/redtheme/etc.st
Harry Karadimas
/______________________________________________________________________
Dr Harry Karadimas Medecin Ingenieur resp. Recherche et Developpement
Departement d'Information Hospitalier
CHU Henri Mondor 51, av. du Mal de Lattre de Tassigny 94010 CRETEIL
tel : (00 33 1) 49 81 21 79 fax : (00 33 1) 49 81 27 08
secr.: (00 33 1) 49 81 23 82 m.el.:harry.karadimas at hmn.ap-hop-paris.fr
/
stringtemplate-interest-request at antlr.org a écrit :
> Send stringtemplate-interest mailing list submissions to
> stringtemplate-interest at antlr.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
> or, via email, send a message with subject or body 'help' to
> stringtemplate-interest-request at antlr.org
>
> You can reach the person managing the list at
> stringtemplate-interest-owner at antlr.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of stringtemplate-interest digest..."
>
>
> Today's Topics:
>
> 1. use template groups in a WAR (Nate)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 10 Nov 2006 17:44:23 -0800
> From: Nate <misc at n4te.com>
> Subject: [stringtemplate-interest] use template groups in a WAR
> To: stringtemplate-interest at antlr.org
> Message-ID: <45552AF7.4080904 at n4te.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> I am writing a web application. I want to use StringTemplate to generate
> the HTML pages. I want users to be able to select a "skin" from a list.
> Each skin would use a different set of templates to display the HTML.
>
> My initial impression is that I'd use a different StringTemplateGroup
> for each skin. I imagined a file structure like this...
>
> skins/redtheme/page.st
> skins/redtheme/etc.st
> skins/bluetheme/page.st
> skins/bluetheme/etc.st
>
> ...the code would be something like...
>
> skinName = "redtheme";
> group = new StringTemplateGroup(skinName, "skins");
> group.getInstanceOf("page");
> group.getInstanceOf("etc");
>
> This works fine on the filesystem. Now I zip my application up into a
> WAR file and suddenly the templates cannot be found. Next I think I
> should look up templates using the classpath. StringTemplate
> documentation leads me to think I need to use code like this...
>
> skinName = "redtheme";
> group = new StringTemplateGroup("allSkins");
> group.getInstanceOf("skins/" + skinName + "/page");
> group.getInstanceOf("skins/" + skinName + "/etc");
>
> There is no "rootDir" when using the classpath, so I cannot use the a
> StringTemplateGroup for each skin, like I could on the filesystem.
>
> What is the solution? How do other people do it? Why does it work so
> differently when JARed or WARed?
>
> Regards,
> Nathan Sweet
>
>
>
> ------------------------------
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
>
>
> End of stringtemplate-interest Digest, Vol 20, Issue 5
> ******************************************************
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20061113/5039284a/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: harry.karadimas.vcf
Type: text/x-vcard
Size: 407 bytes
Desc: not available
Url : http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20061113/5039284a/attachment.vcf
More information about the stringtemplate-interest
mailing list