aspose file tools*
The moose likes Struts and the fly likes comboBox works on JSP page but its empty Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "comboBox works on JSP page but its empty" Watch "comboBox works on JSP page but its empty" New topic
Author

comboBox works on JSP page but its empty

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
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

Joined: Jan 10, 2002
Posts: 61612
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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 ]

Merrill
Consultant, Sima Solutions
Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
thanks...it works
and thank you for the link as well!
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
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

Joined: Feb 15, 2005
Posts: 4864
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: comboBox works on JSP page but its empty