|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfc.util.pagetemplate.TemplateMgr
public final class TemplateMgr
A page template is a simplified molly page, that runs in a non web environment. Good for creating dynamic web pages (for email campaigns, etc) from the command line.
There is another alternate/simpler template mechanism here: Template
.
The page template loads template files (can have any suffix but .template is suggested as opposed to .mp to keep the non-web distinction clear). The template file is compiled (uses the system temp directory for compilation) as needed and the resulting class file is loaded/run. If a template is changed, it is automatically recompiled, reloaded and rerun. If the template has a compilation error, that page remains unloaded until the error is fixed.
The output of the template is written to an output destination (could be a buffer, string, file, etc) and the invoker can then send that output to an email destination.
Template pages only use the system classpath for compilation. Pages can refer to any class found in the system classpath.
Here is some sample usage:
TemplatePage pt = TemplateMgr.getTemplate("/path/to/file.template");
pt.render(new File("/path/to/output.file"));
//To optionally send information to the page, you can say (before calling render):
Map m = new HashMap();
m.put(...whatever..);
pt.setContext(m);
Constructor Summary | |
---|---|
TemplateMgr()
|
Method Summary | |
---|---|
static TemplatePage |
get(java.io.File templateFile)
Returns a runnable page template, alias for the getTemplate(File) method. |
static TemplatePage |
get(java.lang.String templateFilePath)
Returns a runnable page template, alias for the getTemplate(String) method. |
static TemplatePage |
getTemplate(java.io.File templateFile)
Returns a runnable page template. |
static TemplatePage |
getTemplate(java.lang.String templateFilePath)
Returns a runnable page template. |
static void |
main(java.lang.String[] args)
Interactive page manager use for testing. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TemplateMgr()
Method Detail |
---|
public static TemplatePage get(java.lang.String templateFilePath) throws java.lang.Exception
getTemplate(String)
method.
templateFile
- the full path to the template file
java.lang.Exception
public static TemplatePage get(java.io.File templateFile) throws java.lang.Exception
getTemplate(File)
method.
templateFile
- the full path to the template file
java.lang.Exception
public static TemplatePage getTemplate(java.lang.String templateFilePath) throws java.lang.Exception
templateFile
- the full path to the template file
java.lang.Exception
public static TemplatePage getTemplate(java.io.File templateFile) throws java.lang.Exception
templateFile
- the template file
java.lang.Exception
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |