• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

blank combobox, what's missing?

 
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm newbie to struts so I hope O can state the question clearly.

so...I would like to have a combobox with items on my form (say categories)

in my startupMangaer.java I wrote:

ArrayList categories = new ArrayList();
categories.add("Classical");
categories.add("Country");
categories.add("Easy Listening");
categories.add("Heavy Metal");
categories.add("Jazz");
categories.add("New Age");
categories.add("Pop/Rock");
categories.add("R & B");
categories.add("World");
sc.setAttribute("categories",categories);




In my struts-config.xml i wrote:

<plug-in className="dummies.struts.group.StartupManager" />
//I checked it and it works (the categories is populated by the code above)
and in the form I have:

<form-property name="categories" type="java.util.ArrayList" />




In the jsp page I wrote:

<td align="left">
<html:select property="category">
<html ptions
property="categories" />
</html:select>
<html:errors property="category" />
</td>

so, once the jsp is up and running...I don't see the items - it's a blank combobox - anyone???

Thank you
Peter
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
change:

<html:options property="category" />

to:

<html:options collection="category" />

For more information on how to use these tags, refer to:

http://struts.apache.org/struts-doc-1.2.x/userGuide/struts-html.html#options
[ February 06, 2006: Message edited by: Merrill Higginson ]
 
Every plan is a little cooler if you have a blimp. And a tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic