You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by bm...@daimlerchrysler.com on 2004/09/11 19:21:41 UTC

Collections, mental block

Posted by mail <ma...@peneios.com>.
Stuff happens ;-) Good luck!

Chris


bmf5@daimlerchrysler.com wrote:

>
>
>Thanks for the help.  I wasn't instantiating a new object before adding it
>to the list.  Just added the same one over & over. Duh!
>
>
>
>mail <ma...@peneios.com> wrote on 09/11/2004 03:48:57 PM:
>
>  
>
>>Well, the snippet below looks fine and should definitely work.
>>
>>So, if your result doesn't seem to match, I would check the method
>>populating the
>>employeeList. Oh, and make sure you're not having another employeeList
>>in page
>>or request scope, or add the source scope to the html:options line.
>>
>>If you want, you can also use logic:iterate to loop through your
>>collection and display
>>everything for debugging purposes.
>>
>>Chris
>>
>>
>>bmf5@daimlerchrysler.com wrote:
>>
>>    
>>
>>>I'm having a heck of a time figuring out how to use this trio.  I'm so
>>>      
>>>
>used
>  
>
>>>to a for loop in a scriptlet.
>>>
>>>I've gotten to the point where my jsp sees the collection stored in
>>>      
>>>
>session
>  
>
>>>scope. The tags even display the right number of options.  However it's
>>>always the last entry in the collection x number of times where x is the
>>>size of the ArrayList.  I assumed the <options> tag iterated.  Do I have
>>>too?  Here's the code & the results.  I know there are three Nancys.
>>>      
>>>
>The
>  
>
>>>one shown is the last in the list.
>>>
>>>
>>><TD>
>>>     <logic:present name="employeeList" scope="session">
>>>           <html:select property="selectedIndex" size="5">
>>>                 <html:options collection="employeeList"
>>>      
>>>
>property="index"
>  
>
>>>labelProperty="displayName"/>
>>>           </html:select>
>>>     </logic:present>
>>></TD>
>>>
>>>What appears in the select box...
>>>
>>>Smith,Nancy - Qss - Div 7
>>>Smith,Nancy - Qss - Div 7
>>>Smith,Nancy - Qss - Div 7
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>  
>

Re: Collections, mental block

Posted by mail <ma...@peneios.com>.
Well, the snippet below looks fine and should definitely work.

So, if your result doesn't seem to match, I would check the method
populating the
employeeList. Oh, and make sure you're not having another employeeList
in page
or request scope, or add the source scope to the html:options line.

If you want, you can also use logic:iterate to loop through your
collection and display
everything for debugging purposes.

Chris


bmf5@daimlerchrysler.com wrote:

>
>
>I'm having a heck of a time figuring out how to use this trio.  I'm so used
>to a for loop in a scriptlet.
>
>I've gotten to the point where my jsp sees the collection stored in session
>scope. The tags even display the right number of options.  However it's
>always the last entry in the collection x number of times where x is the
>size of the ArrayList.  I assumed the <options> tag iterated.  Do I have
>too?  Here's the code & the results.  I know there are three Nancys.  The
>one shown is the last in the list.
>
>
><TD>
>      <logic:present name="employeeList" scope="session">
>            <html:select property="selectedIndex" size="5">
>                  <html:options collection="employeeList" property="index"
>labelProperty="displayName"/>
>            </html:select>
>      </logic:present>
></TD>
>
>What appears in the select box...
>
>Smith,Nancy - Qss - Div 7
>Smith,Nancy - Qss - Div 7
>Smith,Nancy - Qss - Div 7
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>  
>


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