• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

comboBox works on JSP page but its empty

 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I'm preparing a combobox with the following below.


Later I am calling the arrayList, categories, from my JSP page (it's a struts application) and it looks like this:



the user can see the drop down box on the page but for some reason, and this is where my question kicks in, the comboBox is empty?!?! why?

thanks.

* the arrayList is prepare before the jsp page (startupManager)
[ September 30, 2006: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since your question concerns Struts tags, this has been moved to the Struts forum.

And (a pet peeve of mine) it's not a "combobox" -- that's a completely different type of control that is not available in HTML.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change:

<htmlptions property="categories" />

to:

<htmlptions name="categories" />

See the Struts documentation for further information on this.
[ October 01, 2006: Message edited by: Merrill Higginson ]
 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks...it works
and thank you for the link as well!
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BTW, I always recommend using the htmlptionsCollection tag, just because it is a little easier to use. Here is a quote from the documentation:

This tag differs from the <htmlptions> tag in that it makes more consistent use of the name and property attributes, and allows the collection to be more easily obtained from the enclosing form bean.


edited to get rid of them darn smilies!

- Brent
[ October 02, 2006: Message edited by: Brent Sterling ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My rule of thunb is that if your collection is a collection of Strings that represent both the value and the label, use htmlptions. If your collection is a collection of beans for which one bean property provides the value and the other the label, use <htmlptionsCollection>.
[ October 02, 2006: Message edited by: Merrill Higginson ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic