Awesome! It looked like using the Map saved time and I was looking for a second opinion. I have it working the way you have identified it here, but just wanted to make sure it was not some twisted end-around solution that people would laugh at later!
Say, if I want to display an item's value from the map, what is the syntax? I tried this, but obviously this was too intuitive. :) <s:property value="someMap[someKey]" /> Scott On 5/16/07, Laurie Harper <[EMAIL PROTECTED]> wrote:
But it is simple :-) The note in the docs about 'If the list is a Map...' is just telling you that the tag will automatically use the map key/value pairs to fill the option tags -- i.e. that these are (roughly) equivalent: <s:select list="someMap.entrySet()" listKey="key" listValue="value" ... <s:select list="someMap" ... If 'list' points to a collection that is not a Map, then you need to specify listKey and listValue to tell the tag what properties of the instance objects in the list should be placed into the options. L. [EMAIL PROTECTED] wrote: > Thanks d! It appears that if neither you nor I can easily drop a <s:select > /> on a page and wire it up without fuss-n-muss, perhaps it is causing > others grief too. I just think something this typical should be simple to > code. > > Scott > > On 5/16/07, Dave Newton <[EMAIL PROTECTED]> wrote: >> >> --- [EMAIL PROTECTED] wrote: >> > 1. Where is the getPetDao() method expected to be >> > coded? I'd like to "set" this data from my Tiles >> > Controller. >> >> It can be coded anywhere, but like most of the other >> tags, is expected to be accessible via the OGNL stack. >> >> > 2. Where do the properties listKey/listValue need >> > to be coded and what is the effect of this when list >> >> > is an Iterable Map? >> >> Those are properties of whatever object the list is >> of. I don't have my code in front of me and I don't >> recall what happens when the <s:select.../> is being >> populated from a map, sorry :/ >> >> IIRC if it's a "simple" map the value will be the key >> and the text will be the toString of the value, but... >> IRRC (I Rarely Remember Correctly). >> >> The following may be wrong, but it tripped me up for >> about 15 minutes, and this was how I solved it: >> >> One thing of note regarding <s:select.../> is that the >> "value" attribute apparently needs to be a map with a >> *string* key. So even if the list/set you're >> populating the list from has a java.lang.Long id (like >> all my Hibernate POJOs do) the *value* attribute must >> be a map in order for list "pre-selection" to work. >> >> *If* this is true, it is unfortunate, as it adds a >> step between simply getting the appropriate sets and >> values and just throwing them at <s:select.../> but I >> suppose it makes sense from a practicality standpoint. >> >> d. >> >> >> >> >> >> ____________________________________________________________________________________ >> >> Be a PS3 game guru. >> Get your game face on with the latest PS3 news and previews at Yahoo! >> Games. >> http://videogames.yahoo.com/platform?platform=120121 >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Scott [EMAIL PROTECTED]