You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Brian Pontarelli <br...@pontarelli.com> on 2007/03/20 23:26:20 UTC
Templating issues with FreeMarker
I'm running into some issues using the FreeMarker templates and
overriding them selectively inside my webapp. Apparently you cannot use
the ${themeProperties.parent} variable from overrides because it isn't
available in the FreeMarker context.
Also, the documentation states that you can override single templates
within the web application. I also moved my templateDir into
WEB-INF/templates for security reasons. This however does not work. I
have to override ALL the templates for the theme, not just one.
Otherwise, I get these errors:
SEVERE: error when rendering
java.io.FileNotFoundException: Template
//WEB-INF/template/ajax/form-close.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(FreemarkerTemplateEngine.java:96)
at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:530)
at org.apache.struts2.components.UIBean.end(UIBean.java:484)
at
org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:43)
at
org.apache.jsp.WEB_002dINF.pages.contact_jsp._jspx_meth_struts_005fform_005f0(contact_jsp.java:117)
at
org.apache.jsp.WEB_002dINF.pages.contact_jsp._jspService(contact_jsp.java:64)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at
org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:139)
at
org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)
(snip)
This also causes other issues in that you can longer use templates from
the parent theme. Instead you have to declare every template you will
ever use in the override directory.
I poked around the JIRA bugs and didn't really find any addressing these
two. Just wanted to throw them out there before I opened bugs. These
seem pretty important to me, unless I'm missing something about how to
accomplish these two tasks.
-bp
Re: Templating issues with FreeMarker
Posted by Brian Pontarelli <br...@pontarelli.com>.
I opened a bug for this. Apparently if you change your templateDir,
nothing works any longer.
https://issues.apache.org/struts/browse/WW-1832
-bp
Brian Pontarelli wrote:
>
> I'm running into some issues using the FreeMarker templates and
> overriding them selectively inside my webapp. Apparently you cannot
> use the ${themeProperties.parent} variable from overrides because it
> isn't available in the FreeMarker context.
>
> Also, the documentation states that you can override single templates
> within the web application. I also moved my templateDir into
> WEB-INF/templates for security reasons. This however does not work. I
> have to override ALL the templates for the theme, not just one.
> Otherwise, I get these errors:
>
> SEVERE: error when rendering
> java.io.FileNotFoundException: Template
> //WEB-INF/template/ajax/form-close.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(FreemarkerTemplateEngine.java:96)
>
> at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:530)
> at org.apache.struts2.components.UIBean.end(UIBean.java:484)
> at
> org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:43)
>
> at
> org.apache.jsp.WEB_002dINF.pages.contact_jsp._jspx_meth_struts_005fform_005f0(contact_jsp.java:117)
>
> at
> org.apache.jsp.WEB_002dINF.pages.contact_jsp._jspService(contact_jsp.java:64)
>
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
>
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
>
> at
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
>
> at
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
>
> at
> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
>
> at
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
>
> at
> org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:139)
>
> at
> org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)
>
> (snip)
>
> This also causes other issues in that you can longer use templates
> from the parent theme. Instead you have to declare every template you
> will ever use in the override directory.
>
> I poked around the JIRA bugs and didn't really find any addressing
> these two. Just wanted to throw them out there before I opened bugs.
> These seem pretty important to me, unless I'm missing something about
> how to accomplish these two tasks.
>
> -bp
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org