kand
kand

Reputation: 2338

Freemarker Looking For Default Templates

I set up a template directory through struts.ui.templateDir in my struts.xml. Now, when I access my page, a java.io.FileNotFoundException comes up looking for a bunch of files that I can only guess Freemarker is looking for by default.

Here is one such file:

java.io.FileNotFoundException: Template /WEB-INF/templates/simple/form-close.ftl not found.

I do not want this file or any other file other than the templates I create to be looked for. Is there some way to prevent Freemarker from doing this? Also, where is there documentation for this library? I cannot seem to find anything other than blog sites...

Upvotes: 1

Views: 1870

Answers (1)

proko
proko

Reputation: 1210

Basicly any struts-tag uses one or more *.ftl to render a specific tag to the page (they are required).

You cant 'just remove' some of the templates. If you want to write your own templates, copy all ftls from the struts jar (templates.simple) to your template dir. Then replace the ftls you want to change.

Overriding struts.xml is not nessecary most of the time, you can also set your template path and standard theme via struts.properties.

### Standard UI theme
struts.ui.theme=xhtml
struts.ui.templateDir=template

Update to your comment: I thought, you want to provide your own templates. But you can also specify the 'theme' property for the struts tags to change a single ftl for any tag.

<s:select name="myName" theme="myTheme" />

Then create your select.ftl and add it under src/main/resources/template/myTheme.

Upvotes: 1

Related Questions