struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bruno.o.fa...@bnpparibas.com
Subject Using options tag with name and property attributes
Date Tue, 02 Oct 2001 10:15:31 GMT
Following the documentation, there are two ways to use the options taglib
taht renders a Collection of select option.
- First one : you use the 'collection' attribute in options tag(as
mentionned in struts-example) :
<%
  java.util.ArrayList list = new java.util.ArrayList();
  list.add(new org.apache.struts.webapp.example.LabelValueBean("IMAP Protocol", "imap"));
  list.add(new org.apache.struts.webapp.example.LabelValueBean("POP3 Protocol", "pop3"));
  pageContext.setAttribute("serverTypes", list);
%>
      <html:select property="type">
        <html:options collection="serverTypes" property="value" labelProperty="label"/>
      </html:select>

Ok, this works fine.

- Second way of using options : you don't use 'collection' attribute but 'name' and 'property'
attributes instead,  that refer to a bean and its
property.
This property is supposed to return a collection that will populate the select tag.

Actually, I don't know in this case what this collection should look like. Is it the same
as the one that we use in collection attribute (ie a
collection of LabelValueBean for example) ?
Can anyone show me an example of using options tag with name and property attributes ?

The point is that I've several select boxes in my page, and I would like to encapsulate all
the collections in one unique bean.

Thanks.




This message and any attachments (the "message") is
intended solely for the addressees and is confidential. 
If you receive this message in error, please delete it and 
immediately notify the sender. Any use not in accord with 
its purpose, any dissemination or disclosure, either whole 
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message. 
BNP PARIBAS (and its subsidiaries) shall (will) not 
therefore be liable for the message if modified. 

                ---------------------------------------------

Ce message et toutes les pieces jointes (ci-apres le 
"message") sont etablis a l'intention exclusive de ses 
destinataires et sont confidentiels. Si vous recevez ce 
message par erreur, merci de le detruire et d'en avertir 
immediatement l'expediteur. Toute utilisation de ce 
message non conforme a sa destination, toute diffusion 
ou toute publication, totale ou partielle, est interdite, sauf 
autorisation expresse. L'internet ne permettant pas 
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce 
message, dans l'hypothese ou il aurait ete modifie.

Mime
View raw message