struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Caroline Jen <jiapei_...@yahoo.com>
Subject re: Getting ArrayList of objects from my form bean into my drop down list -> solution
Date Sat, 29 Nov 2003 00:22:09 GMT
What a good timing to see this post.  I was about to
do the same thing in the next day or two.

I have an ArrayList of JavaBean objects created from
accessing the database:

while(rs.next())
{
   editorBean=new
EditorBean(rs.getString("user_name"));
   editors.add(editorBean);
}
   return editors;

Obviously, each EditorBean object is the value of the
"user_name".  If I have this 
request.setAttribute( "EDITORS", editors );

How do I create a drop-down list?  Please comment the
way I tend to code:

<html:select property="editors" multiple="false">
  <bean:define id="EDITORS" name="??????"
property="editors"/>
  <html:options collection="EDITORS" property="?????" 
labelProperty="??????"/>
</html:select>

What should I do with those places I marked with the
question marks (?????)
--- Janice <janice-j@shaw.ca> wrote:
> Just in case some other newbies are doing the same
> thing, this was my
> solution:
> 
> <html:select property="projCodeName">
>   <bean:define id="codes" name="projectForm"
> property="projCodeNames"/>
>   <html:options collection="codes" property="name"
> labelProperty="name"/>
> </html:select>
> 
> Its making a new bean on the .jsp page with my
> ArrayList that was in my form
> bean, and then I can easily get the values from it.
> 
> (I can't wait until this stuff is all second nature!
>  I haven't even started
> doing anything difficult yet!)
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

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


Mime
View raw message