There is a similar question on this site asking for how to set the default vaule for an HTML object .
This relies on setting a "value"
tag for an individually-listed <option>
, but I am using an optionsCollection
, with a pre-set list of options.
<html:select property="optionsList">
<html:optionsCollection name="lutOptions"/>
</html:select>
I tried indicating the desired option
to be selected
, but it doesn't appear to work. Instead, it just creates a new option for the list at the bottom.
<option selected="selected">desired option</option>
How do I set one of the options from the lutOptions
list to be the default option for my optionsCollection
object?
Maybe this link can help you.
http://www.coderanch.com/t/54537/Struts/Set-default-html-select
As mentioned in the link, you can set the ActionForm bean property to the appropriate value. There are three ways to set the ActionForm bean property:
<c:set>
tag reset()
method of the ActionForm bean
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.