We've done this (and it works) :
<jsp:useBean id="search" scope="request" type="xxx.xxx.ourBean"/>
<bean:define id="myCollection" name="search" property="ourList"
scope="request"/>
<html:select name="search" property="ourList">
<html:options collection="myCollection" property="code"
labelProperty="description"/>
</html:select>
where ourBean is a bean which has got a ourList property :
private Vector ourList;
public Vector getOurList() {
return this.ourList;
}
ourList is a vector of objects which countain :
private String code;
private String description;
public String getCode(){
return code;
}
public String getDescription(){
return description;
}
This way we get a combo-box where the lines contain the descriptions.
You'll have to adapt it a bit but I hope it helps you.
Annick Naranjo Sanchez
[EMAIL PROTECTED]
-----Message d'origine-----
De : Zeltser, Mark [mailto:[EMAIL PROTECTED]]
Envoyé : mardi 3 avril 2001 15:55
À : [EMAIL PROTECTED]
Objet : Using <OPTIONS> Tag with bean that has a collection
Hello,
I am trying to use OPTIONS tag with bean that has a collection as one of its
member variables ( the appropriate getter method is provided).
Assuming the following scenario
==========================================================
public class Cache {
private ArrayList productList = null;
public init( ActionServlet servlet) {
// ArrayList initialized
servlet.getServletContext().setAttribute( "cache", this );
}
public ArrayList getProductList() {
return this.productList;
}
}
==========================================================
How would you access productList? Javadoc is hard to understand.
<html:select property="system">
<html:options name="??"
collection="??"
property="??"
labelProperty="??"/>
</html:select>
Thanks, Mark.
----------------------------------------------------------------------------
--
This message is intended only for the personal and confidential use of the
designated recipient(s) named above. If you are not the intended recipient
of this message you are hereby notified that any review, dissemination,
distribution or copying of this message is strictly prohibited. This
communication is for information purposes only and should not be regarded as
an offer to sell or as a solicitation of an offer to buy any financial
product, an official confirmation of any transaction, or as an official
statement of Lehman Brothers Inc. Email transmission cannot be guaranteed
to be secure or error-free. Therefore, we do not represent that this
information is complete or accurate and it should not be relied upon as
such. All information is subject to change without notice.