File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes html:optionsCollection from a DynaActionForm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:optionsCollection from a DynaActionForm" Watch "html:optionsCollection from a DynaActionForm" New topic

html:optionsCollection from a DynaActionForm

Rick Smith

Joined: Oct 04, 2004
Posts: 24
I am having trouble getting a html:select component populated from a DynaActionForm.

The page in question is called from a standard forwardAction so I do not have an Action to populate the form with an initial list, however I have based my code on an example which does not seem to require this.

I have a simple DynaActionForm defined:

And my page attempts to construct the select box as follows:

The intention is that an action would populate the drop down with a different set of options depending on other form data when it is next submitted (which is why initially no Action is 'needed'):

However when I first goto that page I get the error:

I've not made an error with the spelling or case of the property names so I don't understand why this is not working.

Interestingly if I change the name of the filter_type (the value I am expecting to be the selected item for the list) I get a different error!

Which I find quite baffling.

Any help would be very much appreciated, on both the difference beween the two, and how to populate the select component.
[ October 10, 2008: Message edited by: Rich Peate ]
Rick Smith

Joined: Oct 04, 2004
Posts: 24
I got around this problem by providing an initialisation action which is called from the standard forward. This initialisation action ensures that a List (ableit an empty one) is defined on the Dynamic Action Form, successful initialisation then forward to my page where the select list of populated based on the List just defined.
I agree. Here's the link:
subject: html:optionsCollection from a DynaActionForm
It's not a secret anymore!