I want to select option in drop down on condition.
<s:set var="defaultState" value="customerBean.state"/>
<select onchange="reflect(this);" name="customerBean.state" class="form-control" id="state">
<option>Select</option>
<s:iterator value="stateList" var="statevalue">
<s:if test="%{#defaultState.equalsIgnoreCase(stateValue)}">
<option id="stateVal" selected="selected"><s:property value="statevalue"/></option>
</s:if>
<s:else>
<option id="stateVal"><s:property value="statevalue"/></option>
</s:else>
</s:iterator>
</select>
this does not work. But if I put
<s:if test="%{#defaultState.equalsIgnoreCase('Alabama')}">
this works.
Please help.
Aucun commentaire:
Enregistrer un commentaire