I have this Struts tag:
<s:select name="country.id"
list="countries"
listValue="name"
listKey="id"
headerValue="Select Country"
headerKey=""
label="Country" />
which outputs the following HTML code:
<select name="country.id" tabindex="12" id="registration_country">
<option value="">Select Country</option>
<option value="1">United States</option>
<option value="2">Afghanistan</option>
<option value="3">Albania</option>
<option value="4">Algeria</option>
...
<option value="192">Zambia</option>
<option value="193">Zimbabwe</option>
</select>
How do I specify that I want, for example, "Albania" to be preselected in the list?
Use the value
attribute in the s:select
tag:
<s:select name="country.id"
list="countries"
listValue="name"
listKey="id"
headerValue="Select Country"
headerKey=""
label="Country"
value="3" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With