Set default value for selection using java in Struts 1.x

I met answers for Struts 2.x, but not for struts 1.x.

All I have to do is select the default value for loading the page using the 1.x HTML: SELECT tag, which uses the collector option:

<html:select property="status">
  <html:optionsCollection name="statusList" label="description" value="id" />
</html:select>

It seems simple, but I would like to avoid using javascript for this.

+5
source share
2 answers

Have you tried to use the attribute valuein the tag<html:select> ?

<html:select property="status" value="...your status choise here...">
  <html:optionsCollection name="statusList" label="description" value="id" />
</html:select>
+10
source

struts 1 . user159088 "" . :

<html:select name="myForm" property="formField.enabled" title="Enabled" styleId="enabled" value="false">
    <html:option value="true">true</html:option>
    <html:option value="false">false</html:option>
</html:select>

- false . "formField.enabled" :

<html:select name="myForm" property="formField.enabled" title="Enabled" styleId="enabled" value="formField.enabled">
    <html:option value="true">true</html:option>
    <html:option value="false">false</html:option>
</html:select>

- struts .

+2

All Articles