You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Carlos Costa e Silva (JIRA)" <ji...@apache.org> on 2009/02/15 13:08:46 UTC

[jira] Commented: (WW-2920) Parent theme could not be found when customize template dir

    [ https://issues.apache.org/struts/browse/WW-2920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45603#action_45603 ] 

Carlos Costa e Silva commented on WW-2920:
------------------------------------------


I had a similar problem: put the template under webroot "/templates/struts" <constant name="struts.ui.templateDir" value="tempaltes/struts" /> and struts started complaining about not finding temlates that exist only in the simple theme.

Checking, this happens because BaseTemplateEngine.getThemeProps(Template template) does not find the themes.properties file. Looking at the code, the theme.properties file has to be in the classpath: putting the templates under /WEB-INF/classes/templates/strutsand and set <constant name="struts.ui.templateDir" value="templates/struts" /> fixed the problem.

(Note: this was under 2.1.6)

Question: should templates outside the classpath work?


> Parent theme could not be found when customize template dir
> -----------------------------------------------------------
>
>                 Key: WW-2920
>                 URL: https://issues.apache.org/struts/browse/WW-2920
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.1.2
>         Environment: Tomcat 6.0.18
>            Reporter: Tom Nguyen
>
> When customizing freemarker template folder to any different folder than "template"
> <constant name="struts.ui.templateDir" value="WEB-INF/template" />  in struts.xml or 
> struts.ui.templateDir=WEB-INF/template in struts.properties
> struts.ui.theme=xhtml
> When browse to a jsp or action page, errors happen because it could not found the template file in parent dir. for example the actionerror.ftl or div-close.ftl in simple theme (template/simple dir), but struts2 try to look up this file in xhtml(template/xhtml dir)
> 2008-12-17 18:09:56,440 ERROR (org.apache.struts2.components.UIBean:28) - error when rendering
> java.io.FileNotFoundException: Template /WEB-INF/template/xhtml/actionerror.ftl not found.
>         at freemarker.template.Configuration.getTemplate(Configuration.java:489)
>         at freemarker.template.Configuration.getTemplate(Configuration.java:452)
>         at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(Freemarker
> TemplateEngine.java:121)
>         at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:558)
>         at org.apache.struts2.components.UIBean.end(UIBean.java:512)
>         at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.