struts2struts-tags

Convert select tag from Struts1 to Struts2


I started to convert this select from Struts1 to Struts2.

STRUTS1

 <html:select styleId="ss" property="type" styleClass="select2" onchange="checkStatus();">
           <html:options collection="listOfType" property="value" labelProperty="key" />
    </html:select>

STRUTS2

<s:select id="ss" name="type" cssClass="select2" onchange="checkStatus();">
     ...
</s:select>

But I don't know how to convert the options tag.


Solution

  • You can use list attribute

    <s:select id="ss" name="type" cssClass="select2" onchange="checkStatus();"
              list="listOfType" listKey="value" listValue="key"/>
    

    You can read more about <s:select> tag on Struts docs site.