Search code examples
javagoogle-app-enginestringtemplate

How do I use StringTemplate files in Google App Engine?


I'm trying to use StringTemplate in Google App Engine to load a template from a file, but I cannot figure out where to put my template files.

The documentation says that StringTemplate will "Look for templates in CLASSPATH as resources" but I'm not sure what that means in terms of a GAE deployment.

For example, suppose I put my templates in a directory called "templates", and put code like this in my servlet:

StringTemplateGroup group = new StringTemplateGroup("mygroup", "templates");
StringTemplate st = group.getInstanceOf("homepage");

Then where do I put the "templates" directory?


Solution

  • It turns out that it works to put the "templates" directory in your "war" directory.

    This works locally and deployed to GAE (for me, anyway).