Hi Brian,

you are almost there, the way you are doing the html:options tag is trying to fetch 
your collection from the method 'getConstName()' in some bean stored in 
'constituencies' (since you defined 'name' attribute). But you already have your 
collection stored in 'constituencies', then you should use the 'collection' to specify 
the collection with labels and/or values.

Try this:

<html:select property="constName">
    <html:options collection="constituencies" property="constValue" 
labelProperty="constName" />
</html:select>

where 'property' will render the 'value' attribute of <option> and 'labelProperty' 
will render the value shown to the user as option.


Henrique Viecili

PS.: By the way, are you relative of Lisa Boyle? Have her phone number? lol :p
  ----- Original Message ----- 
  From: Brian Boyle 
  To: [EMAIL PROTECTED] 
  Sent: Thursday, May 27, 2004 2:21 PM
  Subject: <html:options> Tag


  Hey!

  I am trying to populate a drop down list with values that I have in a 
  Collection but it is not working. This is what I have so far in my JSP:
  <html:select property="constName">
  <html:options name="constituencies" property="constName" />
  </html:select>
  I have a Collection called constituencies stored in my session and it has 
  javaBeans as elements in it. THese javabeans have a getConstName() attribute 
  so the property="constName" in my tag should be ok.
  However, I think the problem is that my Collection should be a javabean. I 
  read on the struts website 
  http://jakarta.apache.org/struts/userGuide/struts-html.html#options that the 
  javabean represents a collection of other javabeans. How can I have a 
  collection of other javabeans inside my bean?

  I'd appreciate any help.

  THanks,

  Brian

  _________________________________________________________________
  Tired of spam? Get advanced junk mail protection with MSN 8. 
  http://join.msn.com/?page=features/junkmail


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

Reply via email to