Title: New OptionsTag for consideration

Hi there,

I'm new to this group, so I hope this is the place to submit suggestions for Struts tags (please let me know if not!!)

Please find attatched a modification to the org.apache.struts.taglib.html.OptionsTag, which I hope you will consider for a future release of Struts.

It allows you to specify (using the 'collectionProperty' attribute) a property of the current form (or some other bean if the 'collection' attribute is specified) that will itself return a collection of beans.  The 'property' and 'labelPropery' attributes can then be used to specify properties of the individual beans that will be used to set the value of the option and the text displayed to the user.  This is useful if the form is used to return collections of data for drop-down lists that are displayed as part of the current form.  Note that the 'collectionProperty' attribute is optional, if it is not specified then the value specified by 'property' will be displayed to the user.


Below is a sample usage.  It assumes that the current form has a property 'programmeAreaList' that returns a collection of ProgrammeArea objects.  These objects in turn have properties 'programmeAreaID' and 'programmeAreaDescription' that are used to set values and display data:

<html:options collectionProperty="programmeAreaList" property="programmeAreaID" labelProperty="programmeAreaDescription"/>

I have attatched the modified files: OptionsTag.java (lines 112-129 & 211-220), struts-form.xml (lines 945-952) and struts-html.xml (lines 1256-1263).

Regards,

Ian Page
[EMAIL PROTECTED]

PS Keep up the good work!

 

OptionsTag_New.zip

Reply via email to