You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Je...@nlgroup.ca on 2002/03/19 18:39:34 UTC

Re: How can I used html:select with a Collection of String


Hey guy's:
     I am a little confused from what Ted stated:
     "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()
}

I have been using application scoped Vectors that go directly into a
logic:iterate tag with no problem . The Java doc for the java.util Vector
states:
     "As of the Java 2 platform v1.2, this class has been retrofitted to
implement List, so that it becomes a part of Java's collection framework."

We are slowly cleaning up a JSP appwe have and for starters, I have been using
the standalone taglib where I can.  We have chosen the Vector as or "standard"
collection.

Is there more I should consider?






Ted Husted <hu...@apache.org> on 03/19/2002 11:04:43 AM

Please respond to "Struts Users Mailing List" <st...@jakarta.apache.org>

To:   Struts Users Mailing List <st...@jakarta.apache.org>
cc:

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:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>








--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>