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

[jira] Created: (WW-2703) TextField tag renders with wrong NAME value (OGNL not evaluated?)

TextField tag renders with wrong NAME value (OGNL not evaluated?)
-----------------------------------------------------------------

                 Key: WW-2703
                 URL: https://issues.apache.org/struts/browse/WW-2703
             Project: Struts 2
          Issue Type: Bug
          Components: Expression Language, Plugin - Tags
    Affects Versions: 2.1.1
         Environment: BEA Weblogic 10, jdk 1.5.0_06
            Reporter: kris beaumont


[code]
<s:iterator value="languages" var="lang">
                    <s:set var="language" value="lang"/>
                    <tr>
                        <td>
                            <s:text name="editGroup.data.label">
                                <%-- lang.value  --%>
                                <s:param><s:property value="value"/></s:param>
                            </s:text>
                        </td>
                        <td>
                            <s:textfield name="group.translations[translatedLang.langId].value"/>
                        </td>
                    </tr>
                </s:iterator>
[/code]

The problem is in:

                            <s:textfield name="group.translations[translatedLang.langId].value"/>

(I also tried <s:textfield name="group.translations[#lang.translatedLang.langId].value"/> ..)

It renders to HTML as this (partially):

<input type="text" name="group.translations[translatedLang.langId].value" value="Aanbevelingen van de raad" id="groupForm_group_translations_translatedLang_langId__value"/>

while it should be:

<input type="text" name="group.translations[4].value" value="Aanbevelingen van de raad" id="groupForm_group_translations_4_value"/>

as lang is the language in the loop, lang.translatedLang is the language translated (just for clarity, languages is a collection of language translations in the user's language, translatedLang is the language being translated and it has an ID that's used as a key in the 'translations' Map ..)

The bug is that it sets the value correctly, but that the NAME and ID are not evaluated as OGNL ...

Even "<s:textfield key="group.translations[#lang.translatedLang.langId].value"/>" did not work.



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


[jira] Commented: (WW-2703) TextField tag renders with wrong NAME value (OGNL not evaluated?)

Posted by "kris beaumont (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44315#action_44315 ] 

kris beaumont commented on WW-2703:
-----------------------------------

Oops, I really thought I tried all options, but there was one left:

<s:textfield name="group.translations[%{#lang.translatedLang.langId}].value"/>

and that did the trick...

<input type="text" name="group.translations[1].value" value="Councel recommendations" id="groupForm_group_translations_1__value"/>


Sorry for wasting your precious time!





> TextField tag renders with wrong NAME value (OGNL not evaluated?)
> -----------------------------------------------------------------
>
>                 Key: WW-2703
>                 URL: https://issues.apache.org/struts/browse/WW-2703
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Expression Language, Plugin - Tags
>    Affects Versions: 2.1.1
>         Environment: BEA Weblogic 10, jdk 1.5.0_06
>            Reporter: kris beaumont
>
> [code]
> <s:iterator value="languages" var="lang">
>                     <s:set var="language" value="lang"/>
>                     <tr>
>                         <td>
>                             <s:text name="editGroup.data.label">
>                                 <%-- lang.value  --%>
>                                 <s:param><s:property value="value"/></s:param>
>                             </s:text>
>                         </td>
>                         <td>
>                             <s:textfield name="group.translations[translatedLang.langId].value"/>
>                         </td>
>                     </tr>
>                 </s:iterator>
> [/code]
> The problem is in:
>                             <s:textfield name="group.translations[translatedLang.langId].value"/>
> (I also tried <s:textfield name="group.translations[#lang.translatedLang.langId].value"/> ..)
> It renders to HTML as this (partially):
> <input type="text" name="group.translations[translatedLang.langId].value" value="Aanbevelingen van de raad" id="groupForm_group_translations_translatedLang_langId__value"/>
> while it should be:
> <input type="text" name="group.translations[4].value" value="Aanbevelingen van de raad" id="groupForm_group_translations_4_value"/>
> as lang is the language in the loop, lang.translatedLang is the language translated (just for clarity, languages is a collection of language translations in the user's language, translatedLang is the language being translated and it has an ID that's used as a key in the 'translations' Map ..)
> The bug is that it sets the value correctly, but that the NAME and ID are not evaluated as OGNL ...
> Even "<s:textfield key="group.translations[#lang.translatedLang.langId].value"/>" did not work.

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


[jira] Closed: (WW-2703) TextField tag renders with wrong NAME value (OGNL not evaluated?)

Posted by "Jeromy Evans (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2703?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeromy Evans closed WW-2703.
----------------------------

    Resolution: Not A Problem

Looks like a bug, but it's not.  

You need to instruct OGNL that the name and id expressions need to be partially evaluated (to get the index).  The value attribute is correctly fully evaluated.

ie.
 <s:textfield name="group.translations[%{translatedLang.langId}].value" value="group.translations[translatedLang.langId].value/> 

That reads: the name to use is "group.translations[x].value" where x is evaluated, but the value is the result of evaluating the full expression "group.translations[translatedLan.langId].value" (inside the brackets first, then outside).

Please ask further questions in the struts-user list.

> TextField tag renders with wrong NAME value (OGNL not evaluated?)
> -----------------------------------------------------------------
>
>                 Key: WW-2703
>                 URL: https://issues.apache.org/struts/browse/WW-2703
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Expression Language, Plugin - Tags
>    Affects Versions: 2.1.1
>         Environment: BEA Weblogic 10, jdk 1.5.0_06
>            Reporter: kris beaumont
>
> [code]
> <s:iterator value="languages" var="lang">
>                     <s:set var="language" value="lang"/>
>                     <tr>
>                         <td>
>                             <s:text name="editGroup.data.label">
>                                 <%-- lang.value  --%>
>                                 <s:param><s:property value="value"/></s:param>
>                             </s:text>
>                         </td>
>                         <td>
>                             <s:textfield name="group.translations[translatedLang.langId].value"/>
>                         </td>
>                     </tr>
>                 </s:iterator>
> [/code]
> The problem is in:
>                             <s:textfield name="group.translations[translatedLang.langId].value"/>
> (I also tried <s:textfield name="group.translations[#lang.translatedLang.langId].value"/> ..)
> It renders to HTML as this (partially):
> <input type="text" name="group.translations[translatedLang.langId].value" value="Aanbevelingen van de raad" id="groupForm_group_translations_translatedLang_langId__value"/>
> while it should be:
> <input type="text" name="group.translations[4].value" value="Aanbevelingen van de raad" id="groupForm_group_translations_4_value"/>
> as lang is the language in the loop, lang.translatedLang is the language translated (just for clarity, languages is a collection of language translations in the user's language, translatedLang is the language being translated and it has an ID that's used as a key in the 'translations' Map ..)
> The bug is that it sets the value correctly, but that the NAME and ID are not evaluated as OGNL ...
> Even "<s:textfield key="group.translations[#lang.translatedLang.langId].value"/>" did not work.

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


[jira] Issue Comment Edited: (WW-2703) TextField tag renders with wrong NAME value (OGNL not evaluated?)

Posted by "kris beaumont (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44315#action_44315 ] 

beaumkr edited comment on WW-2703 at 7/1/08 1:56 AM:
-----------------------------------------------------------

Oops, I really thought I tried all options, but there was one left:

<s:textfield name="group.translations[%{#lang.translatedLang.langId}].value"/>

and that did the trick...

<input type="text" name="group.translations[1].value" value="Councel recommendations" id="groupForm_group_translations_1__value"/>


Sorry for wasting your precious time!


EDIT

thanks Jeromy, I saw your comment after my post but I'm glad for the help, it made me sure the problem was really with me.

Next time I'll look even further!!


      was (Author: beaumkr):
    Oops, I really thought I tried all options, but there was one left:

<s:textfield name="group.translations[%{#lang.translatedLang.langId}].value"/>

and that did the trick...

<input type="text" name="group.translations[1].value" value="Councel recommendations" id="groupForm_group_translations_1__value"/>


Sorry for wasting your precious time!




  
> TextField tag renders with wrong NAME value (OGNL not evaluated?)
> -----------------------------------------------------------------
>
>                 Key: WW-2703
>                 URL: https://issues.apache.org/struts/browse/WW-2703
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Expression Language, Plugin - Tags
>    Affects Versions: 2.1.1
>         Environment: BEA Weblogic 10, jdk 1.5.0_06
>            Reporter: kris beaumont
>            Assignee: kris beaumont
>
> [code]
> <s:iterator value="languages" var="lang">
>                     <s:set var="language" value="lang"/>
>                     <tr>
>                         <td>
>                             <s:text name="editGroup.data.label">
>                                 <%-- lang.value  --%>
>                                 <s:param><s:property value="value"/></s:param>
>                             </s:text>
>                         </td>
>                         <td>
>                             <s:textfield name="group.translations[translatedLang.langId].value"/>
>                         </td>
>                     </tr>
>                 </s:iterator>
> [/code]
> The problem is in:
>                             <s:textfield name="group.translations[translatedLang.langId].value"/>
> (I also tried <s:textfield name="group.translations[#lang.translatedLang.langId].value"/> ..)
> It renders to HTML as this (partially):
> <input type="text" name="group.translations[translatedLang.langId].value" value="Aanbevelingen van de raad" id="groupForm_group_translations_translatedLang_langId__value"/>
> while it should be:
> <input type="text" name="group.translations[4].value" value="Aanbevelingen van de raad" id="groupForm_group_translations_4_value"/>
> as lang is the language in the loop, lang.translatedLang is the language translated (just for clarity, languages is a collection of language translations in the user's language, translatedLang is the language being translated and it has an ID that's used as a key in the 'translations' Map ..)
> The bug is that it sets the value correctly, but that the NAME and ID are not evaluated as OGNL ...
> Even "<s:textfield key="group.translations[#lang.translatedLang.langId].value"/>" did not work.

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


[jira] Updated: (WW-2703) TextField tag renders with wrong NAME value (OGNL not evaluated?)

Posted by "kris beaumont (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2703?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

kris beaumont updated WW-2703:
------------------------------

    Assignee: kris beaumont
      Status: Resolved  (was: Closed)

this did the trick (notice the %{} around the OGNL key expression..)

<s:textfield name="group.translations[%{#lang.translatedLang.langId}].value"/>

> TextField tag renders with wrong NAME value (OGNL not evaluated?)
> -----------------------------------------------------------------
>
>                 Key: WW-2703
>                 URL: https://issues.apache.org/struts/browse/WW-2703
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Expression Language, Plugin - Tags
>    Affects Versions: 2.1.1
>         Environment: BEA Weblogic 10, jdk 1.5.0_06
>            Reporter: kris beaumont
>            Assignee: kris beaumont
>
> [code]
> <s:iterator value="languages" var="lang">
>                     <s:set var="language" value="lang"/>
>                     <tr>
>                         <td>
>                             <s:text name="editGroup.data.label">
>                                 <%-- lang.value  --%>
>                                 <s:param><s:property value="value"/></s:param>
>                             </s:text>
>                         </td>
>                         <td>
>                             <s:textfield name="group.translations[translatedLang.langId].value"/>
>                         </td>
>                     </tr>
>                 </s:iterator>
> [/code]
> The problem is in:
>                             <s:textfield name="group.translations[translatedLang.langId].value"/>
> (I also tried <s:textfield name="group.translations[#lang.translatedLang.langId].value"/> ..)
> It renders to HTML as this (partially):
> <input type="text" name="group.translations[translatedLang.langId].value" value="Aanbevelingen van de raad" id="groupForm_group_translations_translatedLang_langId__value"/>
> while it should be:
> <input type="text" name="group.translations[4].value" value="Aanbevelingen van de raad" id="groupForm_group_translations_4_value"/>
> as lang is the language in the loop, lang.translatedLang is the language translated (just for clarity, languages is a collection of language translations in the user's language, translatedLang is the language being translated and it has an ID that's used as a key in the 'translations' Map ..)
> The bug is that it sets the value correctly, but that the NAME and ID are not evaluated as OGNL ...
> Even "<s:textfield key="group.translations[#lang.translatedLang.langId].value"/>" did not work.

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