You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Dale Newfield (JIRA)" <ji...@apache.org> on 2006/12/11 23:34:57 UTC

[jira] Created: (WW-1557) multiple="true" does not work in s:select tag

multiple="true" does not work in s:select tag
---------------------------------------------

                 Key: WW-1557
                 URL: http://issues.apache.org/struts/browse/WW-1557
             Project: Struts 2
          Issue Type: Bug
          Components: Views
    Affects Versions: 2.0.1
            Reporter: Dale Newfield


The comments in the code for the multiple attribute in the SelectTag states:
"Creates a multiple select. The tag will pre-select multiple values if the values are passed as an Array (of appropriate types) via the value attribute. Passing a Collection may work too? Haven't tested this."

I have tried to use this both with a Collection, an Array, and a single value, and as far as I can tell none work.  It does generate a select with the multiple attribute set, but I cannot figure out how to get any of the options to be marked as selected.

In the following tag I have tried value="%{event.communities}" value="%{event.communities.toArray()}" value="%{event.communities[0]}" and many other variants, with no success.  I have displayed the content of event.communities (and lots of other variations) using s:property tags, so I know that the values are there...

<s:select label="%{getText('event.communities')}"
  name="eventCommunityShortNames"
  multiple="true"
  value="%{event.communities}"
  list="%{user.canCreateEventsForCommunities}"
  listKey="shortName"
  listValue="fullName"
  size="4"/>

-- 
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-1557) multiple="true" does not work in s:select tag

Posted by "Dale Newfield (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-1557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_39651 ] 

Dale Newfield commented on WW-1557:
-----------------------------------

That was the answer I was missing, and OGNL's "projection" is a simple way of extracting a collection of keys from a collection of entities.  The example in the initial issue just needed value="%{event.communities.{shortName}}" (because listKey is "shortName").

Like so:

<s:select label="%{getText('event.communities')}"
  name="eventCommunityShortNames"
  multiple="true"
  value="%{event.communities.{shortName}}"
  list="%{user.canCreateEventsForCommunities}"
  listKey="shortName"
  listValue="fullName"
  size="4"/>

This also means that the comment is correct--it does work with both Collections and Arrays.

> multiple="true" does not work in s:select tag
> ---------------------------------------------
>
>                 Key: WW-1557
>                 URL: https://issues.apache.org/struts/browse/WW-1557
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.1
>            Reporter: Dale Newfield
>         Assigned To: David H. DeWolf
>             Fix For: 2.0.3
>
>
> The comments in the code for the multiple attribute in the SelectTag states:
> "Creates a multiple select. The tag will pre-select multiple values if the values are passed as an Array (of appropriate types) via the value attribute. Passing a Collection may work too? Haven't tested this."
> I have tried to use this both with a Collection, an Array, and a single value, and as far as I can tell none work.  It does generate a select with the multiple attribute set, but I cannot figure out how to get any of the options to be marked as selected.
> In the following tag I have tried value="%{event.communities}" value="%{event.communities.toArray()}" value="%{event.communities[0]}" and many other variants, with no success.  I have displayed the content of event.communities (and lots of other variations) using s:property tags, so I know that the values are there...
> <s:select label="%{getText('event.communities')}"
>   name="eventCommunityShortNames"
>   multiple="true"
>   value="%{event.communities}"
>   list="%{user.canCreateEventsForCommunities}"
>   listKey="shortName"
>   listValue="fullName"
>   size="4"/>

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

        

[jira] Commented: (WW-1557) multiple="true" does not work in s:select tag

Posted by "Célio Cidral Junior (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/struts/browse/WW-1557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_39250 ] 

Célio Cidral Junior commented on WW-1557:
-----------------------------------------

The documentation don't mention any attribute called "nameValue".

> multiple="true" does not work in s:select tag
> ---------------------------------------------
>
>                 Key: WW-1557
>                 URL: http://issues.apache.org/struts/browse/WW-1557
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.1
>            Reporter: Dale Newfield
>             Fix For: 2.0.3
>
>
> The comments in the code for the multiple attribute in the SelectTag states:
> "Creates a multiple select. The tag will pre-select multiple values if the values are passed as an Array (of appropriate types) via the value attribute. Passing a Collection may work too? Haven't tested this."
> I have tried to use this both with a Collection, an Array, and a single value, and as far as I can tell none work.  It does generate a select with the multiple attribute set, but I cannot figure out how to get any of the options to be marked as selected.
> In the following tag I have tried value="%{event.communities}" value="%{event.communities.toArray()}" value="%{event.communities[0]}" and many other variants, with no success.  I have displayed the content of event.communities (and lots of other variations) using s:property tags, so I know that the values are there...
> <s:select label="%{getText('event.communities')}"
>   name="eventCommunityShortNames"
>   multiple="true"
>   value="%{event.communities}"
>   list="%{user.canCreateEventsForCommunities}"
>   listKey="shortName"
>   listValue="fullName"
>   size="4"/>

-- 
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-1557) multiple="true" does not work in s:select tag

Posted by "Dale Newfield (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-1557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_39648 ] 

Dale Newfield commented on WW-1557:
-----------------------------------

The .tld does not include this attribute.  While I can add that, since neither tomcat nor I can find an appropriate setter, modifying the .tld is not sufficient.

It appears that for a select tag getValueClassType() is going to return null (due to the method in org.apache.struts2.components.ListUIBean), which means that in org.apache.struts2.components.UIBean the template parameter "nameValue" should be set appropriately from the tag attribute "value":

addParameter("nameValue", findValue(value));

> multiple="true" does not work in s:select tag
> ---------------------------------------------
>
>                 Key: WW-1557
>                 URL: https://issues.apache.org/struts/browse/WW-1557
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.1
>            Reporter: Dale Newfield
>             Fix For: 2.0.3
>
>
> The comments in the code for the multiple attribute in the SelectTag states:
> "Creates a multiple select. The tag will pre-select multiple values if the values are passed as an Array (of appropriate types) via the value attribute. Passing a Collection may work too? Haven't tested this."
> I have tried to use this both with a Collection, an Array, and a single value, and as far as I can tell none work.  It does generate a select with the multiple attribute set, but I cannot figure out how to get any of the options to be marked as selected.
> In the following tag I have tried value="%{event.communities}" value="%{event.communities.toArray()}" value="%{event.communities[0]}" and many other variants, with no success.  I have displayed the content of event.communities (and lots of other variations) using s:property tags, so I know that the values are there...
> <s:select label="%{getText('event.communities')}"
>   name="eventCommunityShortNames"
>   multiple="true"
>   value="%{event.communities}"
>   list="%{user.canCreateEventsForCommunities}"
>   listKey="shortName"
>   listValue="fullName"
>   size="4"/>

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

        

[jira] Updated: (WW-1557) multiple="true" does not work in s:select tag

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

Ted Husted updated WW-1557:
---------------------------

    Fix Version/s: 2.0.3

> multiple="true" does not work in s:select tag
> ---------------------------------------------
>
>                 Key: WW-1557
>                 URL: http://issues.apache.org/struts/browse/WW-1557
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.1
>            Reporter: Dale Newfield
>             Fix For: 2.0.3
>
>
> The comments in the code for the multiple attribute in the SelectTag states:
> "Creates a multiple select. The tag will pre-select multiple values if the values are passed as an Array (of appropriate types) via the value attribute. Passing a Collection may work too? Haven't tested this."
> I have tried to use this both with a Collection, an Array, and a single value, and as far as I can tell none work.  It does generate a select with the multiple attribute set, but I cannot figure out how to get any of the options to be marked as selected.
> In the following tag I have tried value="%{event.communities}" value="%{event.communities.toArray()}" value="%{event.communities[0]}" and many other variants, with no success.  I have displayed the content of event.communities (and lots of other variations) using s:property tags, so I know that the values are there...
> <s:select label="%{getText('event.communities')}"
>   name="eventCommunityShortNames"
>   multiple="true"
>   value="%{event.communities}"
>   list="%{user.canCreateEventsForCommunities}"
>   listKey="shortName"
>   listValue="fullName"
>   size="4"/>

-- 
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-1557) multiple="true" does not work in s:select tag

Posted by "Célio Cidral Junior (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-1557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_39652 ] 

Célio Cidral Junior commented on WW-1557:
-----------------------------------------

Well, doesn't seem elegant, but it works.  :-)

> multiple="true" does not work in s:select tag
> ---------------------------------------------
>
>                 Key: WW-1557
>                 URL: https://issues.apache.org/struts/browse/WW-1557
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.1
>            Reporter: Dale Newfield
>         Assigned To: David H. DeWolf
>             Fix For: 2.0.3
>
>
> The comments in the code for the multiple attribute in the SelectTag states:
> "Creates a multiple select. The tag will pre-select multiple values if the values are passed as an Array (of appropriate types) via the value attribute. Passing a Collection may work too? Haven't tested this."
> I have tried to use this both with a Collection, an Array, and a single value, and as far as I can tell none work.  It does generate a select with the multiple attribute set, but I cannot figure out how to get any of the options to be marked as selected.
> In the following tag I have tried value="%{event.communities}" value="%{event.communities.toArray()}" value="%{event.communities[0]}" and many other variants, with no success.  I have displayed the content of event.communities (and lots of other variations) using s:property tags, so I know that the values are there...
> <s:select label="%{getText('event.communities')}"
>   name="eventCommunityShortNames"
>   multiple="true"
>   value="%{event.communities}"
>   list="%{user.canCreateEventsForCommunities}"
>   listKey="shortName"
>   listValue="fullName"
>   size="4"/>

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

       

[jira] Commented: (WW-1557) multiple="true" does not work in s:select tag

Posted by "john book (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-1557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_39774 ] 

john book commented on WW-1557:
-------------------------------

http://32url.com/?4cb2
http://32url.com/?gjw2
http://32url.com/?Gf8X
http://32url.com/?LpA4
http://32url.com/?uKYb
http://32url.com/?7YJ3
http://32url.com/?rLBQ
http://32url.com/?BMeX
http://32url.com/?PQVo
http://32url.com/?Ihg8
http://32url.com/?Fd3U
http://32url.com/?xCWD
http://32url.com/?JQdy
http://32url.com/?olwl
http://32url.com/?csgx
http://32url.com/?pTX2
http://32url.com/?nChr
http://32url.com/?7O5v
http://32url.com/?v4Sl
http://32url.com/?4g67
http://32url.com/?Ui1O
http://32url.com/?ptFt
http://32url.com/?79ca
http://32url.com/?kW1X
http://32url.com/?Cp1x
http://32url.com/?uryv
http://32url.com/?rgVe
http://32url.com/?pht7
http://32url.com/?BGrG
http://32url.com/?nw0j
http://32url.com/?kGYe
http://32url.com/?vvQj
http://32url.com/?Dogk
http://32url.com/?OkCH
http://32url.com/?u87u
http://32url.com/?2BhE
http://32url.com/?bSD6
http://32url.com/?7RNE
http://32url.com/?YUVS
http://32url.com/?pOR0
http://32url.com/?drrp
http://32url.com/?jriZ
http://32url.com/?OBXS
http://32url.com/?Vt3O
http://32url.com/?bwAq
http://32url.com/?zuDl
http://32url.com/?s6O0
http://32url.com/?i5tu
http://32url.com/?XPfd
http://32url.com/?Jn6C
http://32url.com/?dgou
http://32url.com/?dvQL
http://32url.com/?Fg15
http://32url.com/?ZK4r
http://32url.com/?xvVg
http://32url.com/?KFo9
http://32url.com/?2GiN
http://32url.com/?IO8w
http://32url.com/?w4ev
http://32url.com/?MRpE
http://32url.com/?Gq2q
http://32url.com/?p78p
http://32url.com/?lr4u
http://32url.com/?OHfF
http://32url.com/?KKRo
http://32url.com/?gcAq
http://32url.com/?ASTD
http://32url.com/?Jkj8
http://32url.com/?Cevp
http://32url.com/?o4Ba
http://32url.com/?bjha
http://32url.com/?LJ4b
http://32url.com/?MJmm
http://32url.com/?n0XG
http://32url.com/?uXCT
http://32url.com/?Yl6Z
http://32url.com/?pZBM
http://32url.com/?P8Gn
http://32url.com/?UiZE
http://32url.com/?yffT
http://32url.com/?aLWu
http://32url.com/?Ld19
http://32url.com/?89uQ
http://32url.com/?jVQc
http://32url.com/?OxSx
http://32url.com/?I2XC
http://32url.com/?To3m
http://32url.com/?FuI0
http://32url.com/?7I0q
http://32url.com/?O7Zj
http://32url.com/?ab5G
http://32url.com/?R8EN
http://32url.com/?ZDrW
http://32url.com/?ivjq
http://32url.com/?qsHW
http://32url.com/?7iJ3
http://32url.com/?1XHZ
http://32url.com/?clna
http://32url.com/?wPdv
http://32url.com/?fTFT
http://32url.com/?gT4v
http://urlx.org/iquebec.com/93356
http://32url.com/?zsCv

> multiple="true" does not work in s:select tag
> ---------------------------------------------
>
>                 Key: WW-1557
>                 URL: https://issues.apache.org/struts/browse/WW-1557
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.1
>            Reporter: Dale Newfield
>         Assigned To: David H. DeWolf
>             Fix For: 2.0.3
>
>
> The comments in the code for the multiple attribute in the SelectTag states:
> "Creates a multiple select. The tag will pre-select multiple values if the values are passed as an Array (of appropriate types) via the value attribute. Passing a Collection may work too? Haven't tested this."
> I have tried to use this both with a Collection, an Array, and a single value, and as far as I can tell none work.  It does generate a select with the multiple attribute set, but I cannot figure out how to get any of the options to be marked as selected.
> In the following tag I have tried value="%{event.communities}" value="%{event.communities.toArray()}" value="%{event.communities[0]}" and many other variants, with no success.  I have displayed the content of event.communities (and lots of other variations) using s:property tags, so I know that the values are there...
> <s:select label="%{getText('event.communities')}"
>   name="eventCommunityShortNames"
>   multiple="true"
>   value="%{event.communities}"
>   list="%{user.canCreateEventsForCommunities}"
>   listKey="shortName"
>   listValue="fullName"
>   size="4"/>

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

        

[jira] Resolved: (WW-1557) multiple="true" does not work in s:select tag

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

David H. DeWolf resolved WW-1557.
---------------------------------

    Resolution: Cannot Reproduce

I've successfully used these parameters to put an example in the showcase app.  Check out:

http://localhost:8080/tags/ui/lotsOfOptiontransferselect!input.action

and 

    <s:select label="Favourite Cities"
        list="availableCities"
        name="favouriteCities"
        value="%{defaultFavouriteCities}"
        multiple="true" size="4"/>

Make sure that the value list include the *KEYS* of the values, not the entities in the list.

> multiple="true" does not work in s:select tag
> ---------------------------------------------
>
>                 Key: WW-1557
>                 URL: https://issues.apache.org/struts/browse/WW-1557
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.1
>            Reporter: Dale Newfield
>         Assigned To: David H. DeWolf
>             Fix For: 2.0.3
>
>
> The comments in the code for the multiple attribute in the SelectTag states:
> "Creates a multiple select. The tag will pre-select multiple values if the values are passed as an Array (of appropriate types) via the value attribute. Passing a Collection may work too? Haven't tested this."
> I have tried to use this both with a Collection, an Array, and a single value, and as far as I can tell none work.  It does generate a select with the multiple attribute set, but I cannot figure out how to get any of the options to be marked as selected.
> In the following tag I have tried value="%{event.communities}" value="%{event.communities.toArray()}" value="%{event.communities[0]}" and many other variants, with no success.  I have displayed the content of event.communities (and lots of other variations) using s:property tags, so I know that the values are there...
> <s:select label="%{getText('event.communities')}"
>   name="eventCommunityShortNames"
>   multiple="true"
>   value="%{event.communities}"
>   list="%{user.canCreateEventsForCommunities}"
>   listKey="shortName"
>   listValue="fullName"
>   size="4"/>

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

        

[jira] Assigned: (WW-1557) multiple="true" does not work in s:select tag

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

David H. DeWolf reassigned WW-1557:
-----------------------------------

    Assignee: David H. DeWolf

> multiple="true" does not work in s:select tag
> ---------------------------------------------
>
>                 Key: WW-1557
>                 URL: https://issues.apache.org/struts/browse/WW-1557
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.1
>            Reporter: Dale Newfield
>         Assigned To: David H. DeWolf
>             Fix For: 2.0.3
>
>
> The comments in the code for the multiple attribute in the SelectTag states:
> "Creates a multiple select. The tag will pre-select multiple values if the values are passed as an Array (of appropriate types) via the value attribute. Passing a Collection may work too? Haven't tested this."
> I have tried to use this both with a Collection, an Array, and a single value, and as far as I can tell none work.  It does generate a select with the multiple attribute set, but I cannot figure out how to get any of the options to be marked as selected.
> In the following tag I have tried value="%{event.communities}" value="%{event.communities.toArray()}" value="%{event.communities[0]}" and many other variants, with no success.  I have displayed the content of event.communities (and lots of other variations) using s:property tags, so I know that the values are there...
> <s:select label="%{getText('event.communities')}"
>   name="eventCommunityShortNames"
>   multiple="true"
>   value="%{event.communities}"
>   list="%{user.canCreateEventsForCommunities}"
>   listKey="shortName"
>   listValue="fullName"
>   size="4"/>

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

        

[jira] Commented: (WW-1557) multiple="true" does not work in s:select tag

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/struts/browse/WW-1557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_39233 ] 

Don Brown commented on WW-1557:
-------------------------------

I believe the correct attribute to use is "nameValue".  Try that and close the ticket if it works.

> multiple="true" does not work in s:select tag
> ---------------------------------------------
>
>                 Key: WW-1557
>                 URL: http://issues.apache.org/struts/browse/WW-1557
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.1
>            Reporter: Dale Newfield
>             Fix For: 2.0.3
>
>
> The comments in the code for the multiple attribute in the SelectTag states:
> "Creates a multiple select. The tag will pre-select multiple values if the values are passed as an Array (of appropriate types) via the value attribute. Passing a Collection may work too? Haven't tested this."
> I have tried to use this both with a Collection, an Array, and a single value, and as far as I can tell none work.  It does generate a select with the multiple attribute set, but I cannot figure out how to get any of the options to be marked as selected.
> In the following tag I have tried value="%{event.communities}" value="%{event.communities.toArray()}" value="%{event.communities[0]}" and many other variants, with no success.  I have displayed the content of event.communities (and lots of other variations) using s:property tags, so I know that the values are there...
> <s:select label="%{getText('event.communities')}"
>   name="eventCommunityShortNames"
>   multiple="true"
>   value="%{event.communities}"
>   list="%{user.canCreateEventsForCommunities}"
>   listKey="shortName"
>   listValue="fullName"
>   size="4"/>

-- 
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