With a lot of debugging, I think i have found what's wrong.

If you use the default setting,

In method [createTemplateLoader] of class
[org.apache.struts2.views.freemarker.FreemarkerManager],
Struts will create 3 TemplateLoader which is:
1,ClassTemplateLoader, which will load Template from class url
2,WebappTemplateLoader, which will load Template from WebApp folder
3,StrutsClassTemplateLoader, I don't known what different with
ClassTemplateLoader

The 3 TemplateLoader will be executed in this order,
which means, the ClassTemplateLoader get higher priority than
WebappTemplateLoader.
(See method [findTemplateSource] of class
[freemarker.cache.MultiTemplateLoader])

So, if you simply put your template under the WebApp folder,
it will not be used, because the ClassTemplateLoader will load the old
template from struts2-core-2.2.1.jar.

I think it may be a Struts2 bug, because this result is obviously
different from the Struts2 document, but i am not very sure about it.


Before they fix this bug, i suggest you add this setting in your web.xml:

        <context-param>
                <param-name>TemplatePath</param-name>
                <param-value></param-value>
        </context-param>

It will make FreemarkerManager not to create ClassTemplateLoader, so
the WebappTemplateLoader will get highest priority.
I tested it, and it works in my environment.

Or you can set this parameter to:
        <context-param>
                <param-name>TemplatePath</param-name>
                <param-value>class://package</param-value>
        </context-param>
and put your template under the [package].
But i did not test this solution.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to