You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "tm_jee (JIRA)" <ji...@apache.org> on 2006/05/10 07:56:33 UTC

[jira] Created: (WW-1310) radiomap.ftl does not honour Boolean keys.

radiomap.ftl does not honour Boolean keys.
------------------------------------------

         Key: WW-1310
         URL: http://issues.apache.org/struts/browse/WW-1310
     Project: Struts Action 2
        Type: Bug

    Versions: WW 2.2.2    
    Reporter: tm_jee
 Assigned to: tm_jee 
     Fix For: 2.0


Below is Jay email in SAF mailing list about this issue :-

----- Original Message ----
From: Jay H. Hartley <ja...@modius.com>
To: dev@struts.apache.org
Sent: Wednesday, 10 May, 2006 7:46:39 AM
Subject: WW radiomap.ftl bug

I think I've found a bug in the WebWork 2.2.2 template 'radiomap.ftl' in the
simple theme. I have only just joined this list, so forgive me if this is
not going to be used in Struts Action 2.0, or there's a better place to post
this. A proposed patch is included at the end of this message.

The 'radiomap' template doesn't work if the provided list uses Boolean keys.
The 'select' template handles it, but radiomap doesn't. Just FYI, we chose a
radio control for this instead of a checkbox just because of the annoying
parameter-is-null-if-not-checked behavior. I know there are other ways to
address it with a checkbox, but... I'm not using them. Probably why this bug
never came up before, so maybe only I care.

JSP page:

<%@ taglib prefix="ww" uri="/webwork"%>
<ww:set name="enable_options"
    value="#{true: getText('option.enabled'), false:
getText('option.disabled')}"/>
<ww:form name="myForm" id="myForm" action="saveLdapConfig" method="post">
    <ww:radio name="enabled"
        label="%{getText('prompt.enabled')}"
        list="#enable_options"
        />
    ...
</ww:form>

=====================
Results in the following error message:

FreeMarker template error!

Error on line 12, column 79 in template/simple/radiomap.ftl
Expecting a string, date or number here, Expression itemKey is instead a
freemarker.ext.beans.BooleanModel
The problematic instruction:
----------
==&gt; ${itemKey?html} [on line 12, column 77 in
template/simple/radiomap.ftl]
in user-directive ww.iterator [on line 1, column 1 in
template/simple/radiomap.ftl]
in include "/${parameters.templateDir}/simple/radiomap.ftl" [on line 3,
column 1 in template/xhtml/radiomap.ftl]
----------

======================
I can provide the full Java stack trace, if anybody cares, but in looking at
'select.ftl', I think I found the solution.

The select template creates a variable 'itemKeyStr' and uses that anywhere
the string value is used, instead of the 'itemKey' directly. Apparently the
expression ${itemKey?html} doesn't work when itemKey is a Boolean.

I've gotten the above JSP to work by overriding
/template/simple/radiomap.ftl with the text following my signature. Changed
lines are commented.

I'd appreciate any feedback. Please be kind; it's my first post to this
list. :-)

Jay H. Hartley, Ph.D.
Senior Software Engineer/Architect
Modius, Inc.

======================
<@ww.iterator value="parameters.list">
    <#if parameters.listKey?exists>
        <#assign itemKey = stack.findValue(parameters.listKey)/>
    <#else>
        <#assign itemKey = stack.findValue('top')/>
    </#if>
<#--
    Create new variable itemKeyStr, like in select.ftl
-->
    <#assign itemKeyStr = itemKey.toString() />
    <#if parameters.listValue?exists>
        <#assign itemValue = stack.findString(parameters.listValue)/>
    <#else>
        <#assign itemValue = stack.findString('top')/>
    </#if>
<#--
    Use itemKeyStr?html for output instead of itemKey?html
-->
<input type="radio" name="${parameters.name?html}"
id="${parameters.id?html}${itemKeyStr?html}"<#rt/>
<#if tag.contains(parameters.nameValue, itemKey)>
checked="checked"<#rt/>
</#if>
<#--
    Use itemKeyStr?html for output instead of itemKey?html
-->
<#if itemKey?exists>
value="${itemKeyStr?html}"<#rt/>
</#if>
<#if parameters.disabled?default(false)>
disabled="disabled"<#rt/>
</#if>
<#if parameters.tabindex?exists>
tabindex="${parameters.tabindex?html}"<#rt/>
</#if>
<#if parameters.cssClass?exists>
class="${parameters.cssClass?html}"<#rt/>
</#if>
<#if parameters.cssStyle?exists>
style="${parameters.cssStyle?html}"<#rt/>
</#if>
<#if parameters.title?exists>
title="${parameters.title?html}"<#rt/>
</#if>
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
/><#rt/>
<#--
    Use itemKeyStr?html for output instead of itemKey?html
-->
<label for="${parameters.id?html}${itemKeyStr?html}"><#rt/>
    ${itemValue}<#t/>
</label>
</...@ww.iterator>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (WW-1310) radiomap.ftl does not honour Boolean keys.

Posted by "tm_jee (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/struts/browse/WW-1310?page=all ]

tm_jee updated WW-1310:
-----------------------

    Component: Views

> radiomap.ftl does not honour Boolean keys.
> ------------------------------------------
>
>          Key: WW-1310
>          URL: http://issues.apache.org/struts/browse/WW-1310
>      Project: Struts Action 2
>         Type: Bug

>   Components: Views
>     Versions: WW 2.2.2
>     Reporter: tm_jee
>     Assignee: tm_jee
>      Fix For: 2.0

>
> Below is Jay email in SAF mailing list about this issue :-
> ----- Original Message ----
> From: Jay H. Hartley <ja...@modius.com>
> To: dev@struts.apache.org
> Sent: Wednesday, 10 May, 2006 7:46:39 AM
> Subject: WW radiomap.ftl bug
> I think I've found a bug in the WebWork 2.2.2 template 'radiomap.ftl' in the
> simple theme. I have only just joined this list, so forgive me if this is
> not going to be used in Struts Action 2.0, or there's a better place to post
> this. A proposed patch is included at the end of this message.
> The 'radiomap' template doesn't work if the provided list uses Boolean keys.
> The 'select' template handles it, but radiomap doesn't. Just FYI, we chose a
> radio control for this instead of a checkbox just because of the annoying
> parameter-is-null-if-not-checked behavior. I know there are other ways to
> address it with a checkbox, but... I'm not using them. Probably why this bug
> never came up before, so maybe only I care.
> JSP page:
> <%@ taglib prefix="ww" uri="/webwork"%>
> <ww:set name="enable_options"
>     value="#{true: getText('option.enabled'), false:
> getText('option.disabled')}"/>
> <ww:form name="myForm" id="myForm" action="saveLdapConfig" method="post">
>     <ww:radio name="enabled"
>         label="%{getText('prompt.enabled')}"
>         list="#enable_options"
>         />
>     ...
> </ww:form>
> =====================
> Results in the following error message:
> FreeMarker template error!
> Error on line 12, column 79 in template/simple/radiomap.ftl
> Expecting a string, date or number here, Expression itemKey is instead a
> freemarker.ext.beans.BooleanModel
> The problematic instruction:
> ----------
> ==&gt; ${itemKey?html} [on line 12, column 77 in
> template/simple/radiomap.ftl]
> in user-directive ww.iterator [on line 1, column 1 in
> template/simple/radiomap.ftl]
> in include "/${parameters.templateDir}/simple/radiomap.ftl" [on line 3,
> column 1 in template/xhtml/radiomap.ftl]
> ----------
> ======================
> I can provide the full Java stack trace, if anybody cares, but in looking at
> 'select.ftl', I think I found the solution.
> The select template creates a variable 'itemKeyStr' and uses that anywhere
> the string value is used, instead of the 'itemKey' directly. Apparently the
> expression ${itemKey?html} doesn't work when itemKey is a Boolean.
> I've gotten the above JSP to work by overriding
> /template/simple/radiomap.ftl with the text following my signature. Changed
> lines are commented.
> I'd appreciate any feedback. Please be kind; it's my first post to this
> list. :-)
> Jay H. Hartley, Ph.D.
> Senior Software Engineer/Architect
> Modius, Inc.
> ======================
> <@ww.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
> <#--
>     Create new variable itemKeyStr, like in select.ftl
> -->
>     <#assign itemKeyStr = itemKey.toString() />
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <input type="radio" name="${parameters.name?html}"
> id="${parameters.id?html}${itemKeyStr?html}"<#rt/>
> <#if tag.contains(parameters.nameValue, itemKey)>
> checked="checked"<#rt/>
> </#if>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <#if itemKey?exists>
> value="${itemKeyStr?html}"<#rt/>
> </#if>
> <#if parameters.disabled?default(false)>
> disabled="disabled"<#rt/>
> </#if>
> <#if parameters.tabindex?exists>
> tabindex="${parameters.tabindex?html}"<#rt/>
> </#if>
> <#if parameters.cssClass?exists>
> class="${parameters.cssClass?html}"<#rt/>
> </#if>
> <#if parameters.cssStyle?exists>
> style="${parameters.cssStyle?html}"<#rt/>
> </#if>
> <#if parameters.title?exists>
> title="${parameters.title?html}"<#rt/>
> </#if>
> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
> /><#rt/>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <label for="${parameters.id?html}${itemKeyStr?html}"><#rt/>
>     ${itemValue}<#t/>
> </label>
> </...@ww.iterator>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (WW-1310) radiomap.ftl does not honour Boolean keys.

Posted by "tm_jee (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/struts/browse/WW-1310?page=all ]
     
tm_jee resolved WW-1310:
------------------------

    Resolution: Fixed

> radiomap.ftl does not honour Boolean keys.
> ------------------------------------------
>
>          Key: WW-1310
>          URL: http://issues.apache.org/struts/browse/WW-1310
>      Project: Struts Action 2
>         Type: Bug

>   Components: Views
>     Versions: WW 2.2.2
>     Reporter: tm_jee
>     Assignee: tm_jee
>      Fix For: 2.0

>
> Below is Jay email in SAF mailing list about this issue :-
> ----- Original Message ----
> From: Jay H. Hartley <ja...@modius.com>
> To: dev@struts.apache.org
> Sent: Wednesday, 10 May, 2006 7:46:39 AM
> Subject: WW radiomap.ftl bug
> I think I've found a bug in the WebWork 2.2.2 template 'radiomap.ftl' in the
> simple theme. I have only just joined this list, so forgive me if this is
> not going to be used in Struts Action 2.0, or there's a better place to post
> this. A proposed patch is included at the end of this message.
> The 'radiomap' template doesn't work if the provided list uses Boolean keys.
> The 'select' template handles it, but radiomap doesn't. Just FYI, we chose a
> radio control for this instead of a checkbox just because of the annoying
> parameter-is-null-if-not-checked behavior. I know there are other ways to
> address it with a checkbox, but... I'm not using them. Probably why this bug
> never came up before, so maybe only I care.
> JSP page:
> <%@ taglib prefix="ww" uri="/webwork"%>
> <ww:set name="enable_options"
>     value="#{true: getText('option.enabled'), false:
> getText('option.disabled')}"/>
> <ww:form name="myForm" id="myForm" action="saveLdapConfig" method="post">
>     <ww:radio name="enabled"
>         label="%{getText('prompt.enabled')}"
>         list="#enable_options"
>         />
>     ...
> </ww:form>
> =====================
> Results in the following error message:
> FreeMarker template error!
> Error on line 12, column 79 in template/simple/radiomap.ftl
> Expecting a string, date or number here, Expression itemKey is instead a
> freemarker.ext.beans.BooleanModel
> The problematic instruction:
> ----------
> ==&gt; ${itemKey?html} [on line 12, column 77 in
> template/simple/radiomap.ftl]
> in user-directive ww.iterator [on line 1, column 1 in
> template/simple/radiomap.ftl]
> in include "/${parameters.templateDir}/simple/radiomap.ftl" [on line 3,
> column 1 in template/xhtml/radiomap.ftl]
> ----------
> ======================
> I can provide the full Java stack trace, if anybody cares, but in looking at
> 'select.ftl', I think I found the solution.
> The select template creates a variable 'itemKeyStr' and uses that anywhere
> the string value is used, instead of the 'itemKey' directly. Apparently the
> expression ${itemKey?html} doesn't work when itemKey is a Boolean.
> I've gotten the above JSP to work by overriding
> /template/simple/radiomap.ftl with the text following my signature. Changed
> lines are commented.
> I'd appreciate any feedback. Please be kind; it's my first post to this
> list. :-)
> Jay H. Hartley, Ph.D.
> Senior Software Engineer/Architect
> Modius, Inc.
> ======================
> <@ww.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
> <#--
>     Create new variable itemKeyStr, like in select.ftl
> -->
>     <#assign itemKeyStr = itemKey.toString() />
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <input type="radio" name="${parameters.name?html}"
> id="${parameters.id?html}${itemKeyStr?html}"<#rt/>
> <#if tag.contains(parameters.nameValue, itemKey)>
> checked="checked"<#rt/>
> </#if>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <#if itemKey?exists>
> value="${itemKeyStr?html}"<#rt/>
> </#if>
> <#if parameters.disabled?default(false)>
> disabled="disabled"<#rt/>
> </#if>
> <#if parameters.tabindex?exists>
> tabindex="${parameters.tabindex?html}"<#rt/>
> </#if>
> <#if parameters.cssClass?exists>
> class="${parameters.cssClass?html}"<#rt/>
> </#if>
> <#if parameters.cssStyle?exists>
> style="${parameters.cssStyle?html}"<#rt/>
> </#if>
> <#if parameters.title?exists>
> title="${parameters.title?html}"<#rt/>
> </#if>
> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
> /><#rt/>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <label for="${parameters.id?html}${itemKeyStr?html}"><#rt/>
>     ${itemValue}<#t/>
> </label>
> </...@ww.iterator>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (WW-1310) radiomap.ftl does not honour Boolean keys.

Posted by "tm_jee (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/struts/browse/WW-1310?page=all ]

tm_jee updated WW-1310:
-----------------------

    Component: Views

> radiomap.ftl does not honour Boolean keys.
> ------------------------------------------
>
>          Key: WW-1310
>          URL: http://issues.apache.org/struts/browse/WW-1310
>      Project: Struts Action 2
>         Type: Bug

>   Components: Views
>     Versions: WW 2.2.2
>     Reporter: tm_jee
>     Assignee: tm_jee
>      Fix For: 2.0

>
> Below is Jay email in SAF mailing list about this issue :-
> ----- Original Message ----
> From: Jay H. Hartley <ja...@modius.com>
> To: dev@struts.apache.org
> Sent: Wednesday, 10 May, 2006 7:46:39 AM
> Subject: WW radiomap.ftl bug
> I think I've found a bug in the WebWork 2.2.2 template 'radiomap.ftl' in the
> simple theme. I have only just joined this list, so forgive me if this is
> not going to be used in Struts Action 2.0, or there's a better place to post
> this. A proposed patch is included at the end of this message.
> The 'radiomap' template doesn't work if the provided list uses Boolean keys.
> The 'select' template handles it, but radiomap doesn't. Just FYI, we chose a
> radio control for this instead of a checkbox just because of the annoying
> parameter-is-null-if-not-checked behavior. I know there are other ways to
> address it with a checkbox, but... I'm not using them. Probably why this bug
> never came up before, so maybe only I care.
> JSP page:
> <%@ taglib prefix="ww" uri="/webwork"%>
> <ww:set name="enable_options"
>     value="#{true: getText('option.enabled'), false:
> getText('option.disabled')}"/>
> <ww:form name="myForm" id="myForm" action="saveLdapConfig" method="post">
>     <ww:radio name="enabled"
>         label="%{getText('prompt.enabled')}"
>         list="#enable_options"
>         />
>     ...
> </ww:form>
> =====================
> Results in the following error message:
> FreeMarker template error!
> Error on line 12, column 79 in template/simple/radiomap.ftl
> Expecting a string, date or number here, Expression itemKey is instead a
> freemarker.ext.beans.BooleanModel
> The problematic instruction:
> ----------
> ==&gt; ${itemKey?html} [on line 12, column 77 in
> template/simple/radiomap.ftl]
> in user-directive ww.iterator [on line 1, column 1 in
> template/simple/radiomap.ftl]
> in include "/${parameters.templateDir}/simple/radiomap.ftl" [on line 3,
> column 1 in template/xhtml/radiomap.ftl]
> ----------
> ======================
> I can provide the full Java stack trace, if anybody cares, but in looking at
> 'select.ftl', I think I found the solution.
> The select template creates a variable 'itemKeyStr' and uses that anywhere
> the string value is used, instead of the 'itemKey' directly. Apparently the
> expression ${itemKey?html} doesn't work when itemKey is a Boolean.
> I've gotten the above JSP to work by overriding
> /template/simple/radiomap.ftl with the text following my signature. Changed
> lines are commented.
> I'd appreciate any feedback. Please be kind; it's my first post to this
> list. :-)
> Jay H. Hartley, Ph.D.
> Senior Software Engineer/Architect
> Modius, Inc.
> ======================
> <@ww.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
> <#--
>     Create new variable itemKeyStr, like in select.ftl
> -->
>     <#assign itemKeyStr = itemKey.toString() />
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <input type="radio" name="${parameters.name?html}"
> id="${parameters.id?html}${itemKeyStr?html}"<#rt/>
> <#if tag.contains(parameters.nameValue, itemKey)>
> checked="checked"<#rt/>
> </#if>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <#if itemKey?exists>
> value="${itemKeyStr?html}"<#rt/>
> </#if>
> <#if parameters.disabled?default(false)>
> disabled="disabled"<#rt/>
> </#if>
> <#if parameters.tabindex?exists>
> tabindex="${parameters.tabindex?html}"<#rt/>
> </#if>
> <#if parameters.cssClass?exists>
> class="${parameters.cssClass?html}"<#rt/>
> </#if>
> <#if parameters.cssStyle?exists>
> style="${parameters.cssStyle?html}"<#rt/>
> </#if>
> <#if parameters.title?exists>
> title="${parameters.title?html}"<#rt/>
> </#if>
> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
> /><#rt/>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <label for="${parameters.id?html}${itemKeyStr?html}"><#rt/>
>     ${itemValue}<#t/>
> </label>
> </...@ww.iterator>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (WW-1310) radiomap.ftl does not honour Boolean keys.

Posted by "tm_jee (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/struts/browse/WW-1310?page=comments#action_37338 ] 

tm_jee commented on WW-1310:
----------------------------

fixed. changes are at :-

Sending        src/main/resources/template/simple/radiomap.ftl
Sending        src/test/java/org/apache/struts/action2/views/jsp/ui/RadioTest.java
Adding         src/test/resources/org/apache/struts/action2/views/jsp/ui/Radio-3.txt

changed 

<#if parameters.listKey?exists>
        <#assign itemKey = stack.findValue(parameters.listKey)/>
    <#else>
        <#assign itemKey = stack.findValue('top')/>
    </#if>

to 

<#if parameters.listKey?exists>
        <#assign itemKey = stack.findString(parameters.listKey)/>
    <#else>
        <#assign itemKey = stack.findString('top')/>
    </#if>

such that Boolean etc. will be treadted as string 

> radiomap.ftl does not honour Boolean keys.
> ------------------------------------------
>
>          Key: WW-1310
>          URL: http://issues.apache.org/struts/browse/WW-1310
>      Project: Struts Action 2
>         Type: Bug

>   Components: Views
>     Versions: WW 2.2.2
>     Reporter: tm_jee
>     Assignee: tm_jee
>      Fix For: 2.0

>
> Below is Jay email in SAF mailing list about this issue :-
> ----- Original Message ----
> From: Jay H. Hartley <ja...@modius.com>
> To: dev@struts.apache.org
> Sent: Wednesday, 10 May, 2006 7:46:39 AM
> Subject: WW radiomap.ftl bug
> I think I've found a bug in the WebWork 2.2.2 template 'radiomap.ftl' in the
> simple theme. I have only just joined this list, so forgive me if this is
> not going to be used in Struts Action 2.0, or there's a better place to post
> this. A proposed patch is included at the end of this message.
> The 'radiomap' template doesn't work if the provided list uses Boolean keys.
> The 'select' template handles it, but radiomap doesn't. Just FYI, we chose a
> radio control for this instead of a checkbox just because of the annoying
> parameter-is-null-if-not-checked behavior. I know there are other ways to
> address it with a checkbox, but... I'm not using them. Probably why this bug
> never came up before, so maybe only I care.
> JSP page:
> <%@ taglib prefix="ww" uri="/webwork"%>
> <ww:set name="enable_options"
>     value="#{true: getText('option.enabled'), false:
> getText('option.disabled')}"/>
> <ww:form name="myForm" id="myForm" action="saveLdapConfig" method="post">
>     <ww:radio name="enabled"
>         label="%{getText('prompt.enabled')}"
>         list="#enable_options"
>         />
>     ...
> </ww:form>
> =====================
> Results in the following error message:
> FreeMarker template error!
> Error on line 12, column 79 in template/simple/radiomap.ftl
> Expecting a string, date or number here, Expression itemKey is instead a
> freemarker.ext.beans.BooleanModel
> The problematic instruction:
> ----------
> ==&gt; ${itemKey?html} [on line 12, column 77 in
> template/simple/radiomap.ftl]
> in user-directive ww.iterator [on line 1, column 1 in
> template/simple/radiomap.ftl]
> in include "/${parameters.templateDir}/simple/radiomap.ftl" [on line 3,
> column 1 in template/xhtml/radiomap.ftl]
> ----------
> ======================
> I can provide the full Java stack trace, if anybody cares, but in looking at
> 'select.ftl', I think I found the solution.
> The select template creates a variable 'itemKeyStr' and uses that anywhere
> the string value is used, instead of the 'itemKey' directly. Apparently the
> expression ${itemKey?html} doesn't work when itemKey is a Boolean.
> I've gotten the above JSP to work by overriding
> /template/simple/radiomap.ftl with the text following my signature. Changed
> lines are commented.
> I'd appreciate any feedback. Please be kind; it's my first post to this
> list. :-)
> Jay H. Hartley, Ph.D.
> Senior Software Engineer/Architect
> Modius, Inc.
> ======================
> <@ww.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
> <#--
>     Create new variable itemKeyStr, like in select.ftl
> -->
>     <#assign itemKeyStr = itemKey.toString() />
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <input type="radio" name="${parameters.name?html}"
> id="${parameters.id?html}${itemKeyStr?html}"<#rt/>
> <#if tag.contains(parameters.nameValue, itemKey)>
> checked="checked"<#rt/>
> </#if>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <#if itemKey?exists>
> value="${itemKeyStr?html}"<#rt/>
> </#if>
> <#if parameters.disabled?default(false)>
> disabled="disabled"<#rt/>
> </#if>
> <#if parameters.tabindex?exists>
> tabindex="${parameters.tabindex?html}"<#rt/>
> </#if>
> <#if parameters.cssClass?exists>
> class="${parameters.cssClass?html}"<#rt/>
> </#if>
> <#if parameters.cssStyle?exists>
> style="${parameters.cssStyle?html}"<#rt/>
> </#if>
> <#if parameters.title?exists>
> title="${parameters.title?html}"<#rt/>
> </#if>
> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
> /><#rt/>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <label for="${parameters.id?html}${itemKeyStr?html}"><#rt/>
>     ${itemValue}<#t/>
> </label>
> </...@ww.iterator>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (WW-1310) radiomap.ftl does not honour Boolean keys.

Posted by "tm_jee (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/struts/browse/WW-1310?page=all ]
     
tm_jee resolved WW-1310:
------------------------

    Resolution: Fixed

> radiomap.ftl does not honour Boolean keys.
> ------------------------------------------
>
>          Key: WW-1310
>          URL: http://issues.apache.org/struts/browse/WW-1310
>      Project: Struts Action 2
>         Type: Bug

>   Components: Views
>     Versions: WW 2.2.2
>     Reporter: tm_jee
>     Assignee: tm_jee
>      Fix For: 2.0

>
> Below is Jay email in SAF mailing list about this issue :-
> ----- Original Message ----
> From: Jay H. Hartley <ja...@modius.com>
> To: dev@struts.apache.org
> Sent: Wednesday, 10 May, 2006 7:46:39 AM
> Subject: WW radiomap.ftl bug
> I think I've found a bug in the WebWork 2.2.2 template 'radiomap.ftl' in the
> simple theme. I have only just joined this list, so forgive me if this is
> not going to be used in Struts Action 2.0, or there's a better place to post
> this. A proposed patch is included at the end of this message.
> The 'radiomap' template doesn't work if the provided list uses Boolean keys.
> The 'select' template handles it, but radiomap doesn't. Just FYI, we chose a
> radio control for this instead of a checkbox just because of the annoying
> parameter-is-null-if-not-checked behavior. I know there are other ways to
> address it with a checkbox, but... I'm not using them. Probably why this bug
> never came up before, so maybe only I care.
> JSP page:
> <%@ taglib prefix="ww" uri="/webwork"%>
> <ww:set name="enable_options"
>     value="#{true: getText('option.enabled'), false:
> getText('option.disabled')}"/>
> <ww:form name="myForm" id="myForm" action="saveLdapConfig" method="post">
>     <ww:radio name="enabled"
>         label="%{getText('prompt.enabled')}"
>         list="#enable_options"
>         />
>     ...
> </ww:form>
> =====================
> Results in the following error message:
> FreeMarker template error!
> Error on line 12, column 79 in template/simple/radiomap.ftl
> Expecting a string, date or number here, Expression itemKey is instead a
> freemarker.ext.beans.BooleanModel
> The problematic instruction:
> ----------
> ==&gt; ${itemKey?html} [on line 12, column 77 in
> template/simple/radiomap.ftl]
> in user-directive ww.iterator [on line 1, column 1 in
> template/simple/radiomap.ftl]
> in include "/${parameters.templateDir}/simple/radiomap.ftl" [on line 3,
> column 1 in template/xhtml/radiomap.ftl]
> ----------
> ======================
> I can provide the full Java stack trace, if anybody cares, but in looking at
> 'select.ftl', I think I found the solution.
> The select template creates a variable 'itemKeyStr' and uses that anywhere
> the string value is used, instead of the 'itemKey' directly. Apparently the
> expression ${itemKey?html} doesn't work when itemKey is a Boolean.
> I've gotten the above JSP to work by overriding
> /template/simple/radiomap.ftl with the text following my signature. Changed
> lines are commented.
> I'd appreciate any feedback. Please be kind; it's my first post to this
> list. :-)
> Jay H. Hartley, Ph.D.
> Senior Software Engineer/Architect
> Modius, Inc.
> ======================
> <@ww.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
> <#--
>     Create new variable itemKeyStr, like in select.ftl
> -->
>     <#assign itemKeyStr = itemKey.toString() />
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <input type="radio" name="${parameters.name?html}"
> id="${parameters.id?html}${itemKeyStr?html}"<#rt/>
> <#if tag.contains(parameters.nameValue, itemKey)>
> checked="checked"<#rt/>
> </#if>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <#if itemKey?exists>
> value="${itemKeyStr?html}"<#rt/>
> </#if>
> <#if parameters.disabled?default(false)>
> disabled="disabled"<#rt/>
> </#if>
> <#if parameters.tabindex?exists>
> tabindex="${parameters.tabindex?html}"<#rt/>
> </#if>
> <#if parameters.cssClass?exists>
> class="${parameters.cssClass?html}"<#rt/>
> </#if>
> <#if parameters.cssStyle?exists>
> style="${parameters.cssStyle?html}"<#rt/>
> </#if>
> <#if parameters.title?exists>
> title="${parameters.title?html}"<#rt/>
> </#if>
> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
> /><#rt/>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <label for="${parameters.id?html}${itemKeyStr?html}"><#rt/>
>     ${itemValue}<#t/>
> </label>
> </...@ww.iterator>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (WW-1310) radiomap.ftl does not honour Boolean keys.

Posted by "tm_jee (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/struts/browse/WW-1310?page=comments#action_37338 ] 

tm_jee commented on WW-1310:
----------------------------

fixed. changes are at :-

Sending        src/main/resources/template/simple/radiomap.ftl
Sending        src/test/java/org/apache/struts/action2/views/jsp/ui/RadioTest.java
Adding         src/test/resources/org/apache/struts/action2/views/jsp/ui/Radio-3.txt

changed 

<#if parameters.listKey?exists>
        <#assign itemKey = stack.findValue(parameters.listKey)/>
    <#else>
        <#assign itemKey = stack.findValue('top')/>
    </#if>

to 

<#if parameters.listKey?exists>
        <#assign itemKey = stack.findString(parameters.listKey)/>
    <#else>
        <#assign itemKey = stack.findString('top')/>
    </#if>

such that Boolean etc. will be treadted as string 

> radiomap.ftl does not honour Boolean keys.
> ------------------------------------------
>
>          Key: WW-1310
>          URL: http://issues.apache.org/struts/browse/WW-1310
>      Project: Struts Action 2
>         Type: Bug

>   Components: Views
>     Versions: WW 2.2.2
>     Reporter: tm_jee
>     Assignee: tm_jee
>      Fix For: 2.0

>
> Below is Jay email in SAF mailing list about this issue :-
> ----- Original Message ----
> From: Jay H. Hartley <ja...@modius.com>
> To: dev@struts.apache.org
> Sent: Wednesday, 10 May, 2006 7:46:39 AM
> Subject: WW radiomap.ftl bug
> I think I've found a bug in the WebWork 2.2.2 template 'radiomap.ftl' in the
> simple theme. I have only just joined this list, so forgive me if this is
> not going to be used in Struts Action 2.0, or there's a better place to post
> this. A proposed patch is included at the end of this message.
> The 'radiomap' template doesn't work if the provided list uses Boolean keys.
> The 'select' template handles it, but radiomap doesn't. Just FYI, we chose a
> radio control for this instead of a checkbox just because of the annoying
> parameter-is-null-if-not-checked behavior. I know there are other ways to
> address it with a checkbox, but... I'm not using them. Probably why this bug
> never came up before, so maybe only I care.
> JSP page:
> <%@ taglib prefix="ww" uri="/webwork"%>
> <ww:set name="enable_options"
>     value="#{true: getText('option.enabled'), false:
> getText('option.disabled')}"/>
> <ww:form name="myForm" id="myForm" action="saveLdapConfig" method="post">
>     <ww:radio name="enabled"
>         label="%{getText('prompt.enabled')}"
>         list="#enable_options"
>         />
>     ...
> </ww:form>
> =====================
> Results in the following error message:
> FreeMarker template error!
> Error on line 12, column 79 in template/simple/radiomap.ftl
> Expecting a string, date or number here, Expression itemKey is instead a
> freemarker.ext.beans.BooleanModel
> The problematic instruction:
> ----------
> ==&gt; ${itemKey?html} [on line 12, column 77 in
> template/simple/radiomap.ftl]
> in user-directive ww.iterator [on line 1, column 1 in
> template/simple/radiomap.ftl]
> in include "/${parameters.templateDir}/simple/radiomap.ftl" [on line 3,
> column 1 in template/xhtml/radiomap.ftl]
> ----------
> ======================
> I can provide the full Java stack trace, if anybody cares, but in looking at
> 'select.ftl', I think I found the solution.
> The select template creates a variable 'itemKeyStr' and uses that anywhere
> the string value is used, instead of the 'itemKey' directly. Apparently the
> expression ${itemKey?html} doesn't work when itemKey is a Boolean.
> I've gotten the above JSP to work by overriding
> /template/simple/radiomap.ftl with the text following my signature. Changed
> lines are commented.
> I'd appreciate any feedback. Please be kind; it's my first post to this
> list. :-)
> Jay H. Hartley, Ph.D.
> Senior Software Engineer/Architect
> Modius, Inc.
> ======================
> <@ww.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
> <#--
>     Create new variable itemKeyStr, like in select.ftl
> -->
>     <#assign itemKeyStr = itemKey.toString() />
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <input type="radio" name="${parameters.name?html}"
> id="${parameters.id?html}${itemKeyStr?html}"<#rt/>
> <#if tag.contains(parameters.nameValue, itemKey)>
> checked="checked"<#rt/>
> </#if>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <#if itemKey?exists>
> value="${itemKeyStr?html}"<#rt/>
> </#if>
> <#if parameters.disabled?default(false)>
> disabled="disabled"<#rt/>
> </#if>
> <#if parameters.tabindex?exists>
> tabindex="${parameters.tabindex?html}"<#rt/>
> </#if>
> <#if parameters.cssClass?exists>
> class="${parameters.cssClass?html}"<#rt/>
> </#if>
> <#if parameters.cssStyle?exists>
> style="${parameters.cssStyle?html}"<#rt/>
> </#if>
> <#if parameters.title?exists>
> title="${parameters.title?html}"<#rt/>
> </#if>
> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
> /><#rt/>
> <#--
>     Use itemKeyStr?html for output instead of itemKey?html
> -->
> <label for="${parameters.id?html}${itemKeyStr?html}"><#rt/>
>     ${itemValue}<#t/>
> </label>
> </...@ww.iterator>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira