Dan*_*rzo 5 java forms struts struts2 struts-tags
我有这个Struts标签:
<s:select name="country.id"
list="countries"
listValue="name"
listKey="id"
headerValue="Select Country"
headerKey=""
label="Country" />
Run Code Online (Sandbox Code Playgroud)
它输出以下HTML代码:
<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>
Run Code Online (Sandbox Code Playgroud)
如何指定我想要的,例如,在列表中预先选择"阿尔巴尼亚"?
使用标记中的value
属性s:select
:
<s:select name="country.id"
list="countries"
listValue="name"
listKey="id"
headerValue="Select Country"
headerKey=""
label="Country"
value="3" />
Run Code Online (Sandbox Code Playgroud)