Hello,

I'm currently working on my first Struts application and I'm facing two problems.

First, I've created a custom tag that creates different types of HTML form fields.
The number of fields generated varies and the names of the fields are dynamic.
I can't figure out how to let Struts populate the ActionForm that's linked to the 
Action that handles the form.
I thought I read somewhere that you can use some feature of the JavaBean specs to tell 
Struts what method to call (maybe by using PropertyDescriptors?), but I can't find 
anything about this.

Second, I don't know how I can restore any previously submitted values when the form 
is shown for a second time, for example in case of a validation error. Do I have 
access to the ActionForm from a custom tag implementation somehow? Or can I let the 
ActionForm set properties in my custom tag?
I've been looking at the source code for the Struts <html:select>-tag but found no 
clues to how Struts manages to make the last submitted item selected when the form is 
redisplayed.
When I use the following Stuts HTML

 <html:select property="selectedDocTypeId">
 <html:options collection="docTypeList" property="id" labelProperty="name"/>
 </html:select>

how does the select-tag know which ActionForm bean it should use to get the selected 
item. I've recompiled the select-tag with some debugging output and put it in my own 
taglib, but the I get the Exception I expected: there is no form bean under the 
default name used in the select-tag in pageContext. 

I'm really at a loss and I hope you can help me with this.

Thanks in advance,

Freek Segers

Reply via email to