You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Joel Wijngaarde (JIRA)" <ji...@apache.org> on 2007/10/26 16:42:40 UTC

[jira] Commented: (WW-2223) listKey and listValue cannot be left out in a <@s.select> which is part of a freemarker template (contrary to the JSP tag )

    [ https://issues.apache.org/struts/browse/WW-2223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42456 ] 

Joel Wijngaarde commented on WW-2223:
-------------------------------------

A simple example:

<#include "/${parameters.templateDir}/${parameters.theme}/controlheader.ftl" />

<@s.select name="${parameters.currency?default('')}" value="${parameters.currencyValue?default('')}" required="true" theme="simple"
    list=r'#{"EUR":"EUR", "USD":"USD", "GBP":"GBP"}' 
/>
<@s.textfield name="${parameters.amount?default('')}" value="${parameters.amountValue?default('')}" size="8" required="true" theme="simple"/>

<#include "/${parameters.templateDir}/xhtml/controlfooter.ftl" />

If you use this template in your jsp as follows:

 <s:component key="project.estimatedValue" required="true" template="/components/monetaryselector.ftl">
        <s:param name="currency" value="'project.estimatedValue.currencyCode'"/>
        <s:param name="currencyValue" value="project.estimatedValue.currencyCode"/>
        <s:param name="amount" value="'project.estimatedValue.value'"/>
        <s:param name="amountValue" value="%{project.estimatedValue.value}"/>        
</s:component>

The value will not be selected when you return to the form because of for instance errors


> listKey and listValue cannot be left out in a <@s.select> which is part of a freemarker template (contrary to the JSP tag <s:select>)
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-2223
>                 URL: https://issues.apache.org/struts/browse/WW-2223
>             Project: Struts 2
>          Issue Type: Bug
>            Reporter: Kris Coolsaet
>             Fix For: 2.0.12
>
>
> If you use a <@s.select ..> as part of a freemarker template to be called by the <s:component ...> tag, using a hashmap
> as the value for the 'list' attribute does not work, unless you also explicitely set 'listKey' equal to 'key' and listValue' to 'value'.
> This is very confusing, as this is not needed in the case of the JSP tag <s:select ...> .

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