sorry about it, I was probably sleeping yesterday :)  Thanks for pointing
out though.

Yanhui

-----Original Message-----
From: Steve Wilkinson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 6:15 PM
To: Struts user
Subject: Re: How can I used html:select with a Collection of String


Of course he means Integer types and not int since primitive types can't be
stored in a Vector.

----- Original Message -----
From: Yu, Yanhui
Sent: Tuesday, March 19, 2002 1:31 PM
To: '[EMAIL PROTECTED]'; Struts Users Mailing List
Subject: RE: How can I used html:select with a Collection of String

Or if you want to use Vector:
1. pass the aVector which holds your int data to jsp via request/session in
the action.perform()
session.setAttribute("namepassedfromaction", aVector);
2. then you can do the following in the jsp:
<jsp:useBean id="you call" name="namepassedfromaction" scope="session or
request" class="java.util.Vector">
<logic:iterate id="listnameyoulike" name="you call" scope="session">
<bean:write name="listnameyoulike">
</logic:iterate>
to display all elements in the Vector.

We have String in Vector, you use int in Vector.  Hope it helps,
Yanhui

-----Original Message-----
From: Ted Husted [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 11:05 AM
To: Struts Users Mailing List
Subject: Re: How can I used html:select with a Collection of String


People often have trouble using Vectors with the Struts tags. They are
really designed to work best with the new Collection objects or with
simple arrays. My best advice would be to have a property like

Object[] getCollection() {
  return vector.toArray()
}

But if you search the mail-archives, there have been several threads
about this.

http://www.mail-archive.com/struts-user%40jakarta.apache.org/

If you come up with a good answer, I'll put in the newbie FAQ we're
constructing.

http://jakarta.apache.org/struts/newbie.html

-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services


"Aroui, Dr. Djelloul" wrote:
>
> myCollection is a Vector of Integer. I dont need property or
labelProperty.
> How can I use the select with a Collection.
>
> <html:select property="id">
> <html:options collection="myCollection"/>
> </html:select>
>
> please any help
>
> thanks
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to