[stringtemplate-interest] proper stringtemplate loading from a webapp
Dave Rafkind
dave.rafkind at gmail.com
Thu Jan 31 07:23:08 PST 2008
Hi list, I apologize if this question has been answered before, I'm
having trouble getting good list search results out of google. But anyways:
The normal StringTemplateGroup constructor looks like:
StringTemplateGroup stg = new StringTemplateGroup(name,hard_coded_path);
I'd like to avoid hardcoding that path in my web application, and
instead create a custom template loader to get at the files the "right"
way which would be something like (from in a servlet):
context = getServletContext();
URL templateRoot = context.getResource("/templates");
StringTemplateGroup stg =
new StringTemplateGroup(name, templateRoot);
which would use templateRoot.getUrlConnection() to get the
stringtemplate files instead of a File() object.
How would I go about doing such a thing?
Thanks,
Dave
More information about the stringtemplate-interest
mailing list