> -----Original Message----- > From: Cathy Osekizoglu [mailto:[EMAIL PROTECTED]] > Sent: Friday, October 04, 2002 11:57 AM > To: Struts Users Mailing List > Subject: How to set default > > I am using <html:options> tag to get a dropdown list. How > can I make an item as default so every time I open the page > that contains the dropdown list, it will show the default. Thanks.
Every situation where you want components on the page to show a "default" is done by setting properties of the form bean used to display the page, in your Action code. In truth, there are no "defaults", your view components are just going to reflect the properties of your form bean, or the "current" value, if you like. If you want the component to show a particular value, your action code should set the appropriate form bean attributes. Each component in the HTML tag library is slightly different wrt what "property" structure it needs to determine its current value. The "html:options" tag is a little decieving, I guess, in that that is not the component that determines the current value, it is the "html:select" tag that needs to know the current value. The property referenced by the "html:select" tag should be a bean or collection containing the list of items which should be selected. You might look at the "struts-exercise-taglib" application for simple demonstrations of these features. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>