You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by John Boyer <jo...@rodaxsoft.com> on 2014/05/01 20:37:58 UTC
Unable to Find FreeMarker Template in Struts 2.3.16.2
Hello:
I've upgraded from Struts 2.3.4.1 to Struts 2.3.16.2. I've been using the KUTheme to render a vertical checkbox list as outlined in 2.2x docs at http://goo.gl/vHqXBH. However, now the framework is unable to find KUTheme template in Struts 2.3.16.2. It's located in default location at `template/KUTheme`, but I get the following FreeMarker template error:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error reading included file template/~~~KUTheme/controlheader-core.ftl
The problematic instruction:
----------
==> include "/${parameters.templateDir}/${parameters.expandTheme}/controlheader-core.ftl" [on line 23, column 1 in template/xhtml/controlheader.ftl]
in include "/${parameters.templateDir}/xhtml/controlheader.ftl" [on line 1, column 1 in template/KUTheme/checkboxlist.ftl]
----------
Java backtrace for programmers:
----------
freemarker.template.TemplateException: Error reading included file template/~~~KUTheme/controlheader-core.ftl
...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Does anyone know to fix this problem?
I've included the theme's file content below, if that helps.
Thank you for your time in advance.
Regards,
John Boyer
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
KUTheme Files
<!-- template/KUTheme/checkboxlist.ftl content... -->
<#include "/${parameters.templateDir}/xhtml/controlheader.ftl" />
<#include "/${parameters.templateDir}/KUTheme_simple/checkboxlist.ftl" />
<#include "/${parameters.templateDir}/xhtml/controlfooter.ftl" /><#nt/>
<!-- template/KUTheme_simple/checkboxlist.ftl content... -->
<#assign itemCount = 0/>
<#if parameters.list??>
<@s.iterator value="parameters.list">
<#assign itemCount = itemCount + 1/>
<#if parameters.listKey??>
<#assign itemKey = stack.findValue(parameters.listKey)/>
<#else>
<#assign itemKey = stack.findValue('top')/>
</#if>
<#if parameters.listValue??>
<#assign itemValue = stack.findString(parameters.listValue)?default("")/>
<#else>
<#assign itemValue = stack.findString('top')/>
</#if>
<#assign itemKeyStr=itemKey.toString() />
<input type="checkbox" name="${parameters.name?html}" value="${itemKeyStr?html}" id="${parameters.name?html}-${itemCount}"<#rt/>
<#if tag.contains(parameters.nameValue, itemKey)>
checked="checked"<#rt/>
</#if>
<#if parameters.disabled?default(false)>
disabled="disabled"<#rt/>
</#if>
<#if parameters.title??>
title="${parameters.title?html}"<#rt/>
</#if>
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
<#include "/${parameters.templateDir}/simple/common-attributes.ftl" />
/>
<label for="${parameters.name?html}-${itemCount}" style="font-weight:normal">${itemValue?html}</label> <br />
</...@s.iterator>
<#else>
</#if>
<input type="hidden" id="__multiselect_${parameters.id?html}" name="__multiselect_${parameters.name?html}" value=""<#rt/>
<#if parameters.disabled?default(false)>
disabled="disabled"<#rt/>
</#if>
/>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Unable to Find FreeMarker Template in Struts 2.3.16.2
Posted by "bphillips@ku.edu" <bp...@ku.edu>.
John:
You may want to use git clone to get our updated Struts 2 example
projects: git clone http://git.apache.org/struts-examples.git
In the example projects is one for Struts 2 Themes that shows how the
customized .ftl files are under src/main/resources (in specific folders) and
also the addition of a theme.properties file.
There is also an updated tutorial on Struts 2 custom themes:
http://struts.apache.org/release/2.3.x/docs/struts-2-themes.html
Hope this helps you.
Bruce
--
View this message in context: http://struts.1045723.n5.nabble.com/Unable-to-Find-FreeMarker-Template-in-Struts-2-3-16-2-tp5715856p5715869.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Unable to Find FreeMarker Template in Struts 2.3.16.2
Posted by Lukasz Lenart <lu...@apache.org>.
This is issue is already solved in upcoming 2.3.18 version [1], the
simplest solution is to move template folder to be on classpath not
under webapp folder, if you use Maven then move template folder from
src/main/webapp to src/main/resources
[1] https://issues.apache.org/jira/browse/WW-4260
Regards
--
Ćukasz
+ 48 606 323 122 http://www.lenart.org.pl/
2014-05-01 20:37 GMT+02:00 John Boyer <jo...@rodaxsoft.com>:
> Hello:
>
> I've upgraded from Struts 2.3.4.1 to Struts 2.3.16.2. I've been using the KUTheme to render a vertical checkbox list as outlined in 2.2x docs at http://goo.gl/vHqXBH. However, now the framework is unable to find KUTheme template in Struts 2.3.16.2. It's located in default location at `template/KUTheme`, but I get the following FreeMarker template error:
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Error reading included file template/~~~KUTheme/controlheader-core.ftl
> The problematic instruction:
> ----------
> ==> include "/${parameters.templateDir}/${parameters.expandTheme}/controlheader-core.ftl" [on line 23, column 1 in template/xhtml/controlheader.ftl]
> in include "/${parameters.templateDir}/xhtml/controlheader.ftl" [on line 1, column 1 in template/KUTheme/checkboxlist.ftl]
> ----------
>
> Java backtrace for programmers:
> ----------
> freemarker.template.TemplateException: Error reading included file template/~~~KUTheme/controlheader-core.ftl
> ...
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Does anyone know to fix this problem?
>
> I've included the theme's file content below, if that helps.
>
> Thank you for your time in advance.
>
> Regards,
>
> John Boyer
>
>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> KUTheme Files
>
> <!-- template/KUTheme/checkboxlist.ftl content... -->
> <#include "/${parameters.templateDir}/xhtml/controlheader.ftl" />
> <#include "/${parameters.templateDir}/KUTheme_simple/checkboxlist.ftl" />
> <#include "/${parameters.templateDir}/xhtml/controlfooter.ftl" /><#nt/>
>
>
> <!-- template/KUTheme_simple/checkboxlist.ftl content... -->
> <#assign itemCount = 0/>
> <#if parameters.list??>
> <@s.iterator value="parameters.list">
> <#assign itemCount = itemCount + 1/>
> <#if parameters.listKey??>
> <#assign itemKey = stack.findValue(parameters.listKey)/>
> <#else>
> <#assign itemKey = stack.findValue('top')/>
> </#if>
> <#if parameters.listValue??>
> <#assign itemValue = stack.findString(parameters.listValue)?default("")/>
> <#else>
> <#assign itemValue = stack.findString('top')/>
> </#if>
> <#assign itemKeyStr=itemKey.toString() />
> <input type="checkbox" name="${parameters.name?html}" value="${itemKeyStr?html}" id="${parameters.name?html}-${itemCount}"<#rt/>
> <#if tag.contains(parameters.nameValue, itemKey)>
> checked="checked"<#rt/>
> </#if>
> <#if parameters.disabled?default(false)>
> disabled="disabled"<#rt/>
> </#if>
> <#if parameters.title??>
> title="${parameters.title?html}"<#rt/>
> </#if>
> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
> <#include "/${parameters.templateDir}/simple/common-attributes.ftl" />
> />
> <label for="${parameters.name?html}-${itemCount}" style="font-weight:normal">${itemValue?html}</label> <br />
> </...@s.iterator>
> <#else>
>
> </#if>
> <input type="hidden" id="__multiselect_${parameters.id?html}" name="__multiselect_${parameters.name?html}" value=""<#rt/>
> <#if parameters.disabled?default(false)>
> disabled="disabled"<#rt/>
> </#if>
> />
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org