I am migrating checkbox from Struts1 to Struts2. So I changed the code from Struts1
<html:checkbox style="border:0px" property="eDir" disabled="true"/>
to
<s:checkbox theme="simple" style="border:0px" name="eDir" disabled="true"></s:checkbox>
but I don't get the checkbox as checked even if the value is true
Below are the html script of both
Struts1 html:
<input type="checkbox" name="eDir2ColTrue" value="on" checked="checked" disabled="disabled" style="border:0px">
Struts2 html:
<input type="checkbox" name="eDir2ColTrue" value="true" disabled="disabled" id="eDir2ColTrue" style="border:0px">
<input type="hidden" id="__checkbox_eDir2ColTrue" name="__checkbox_eDir2ColTrue" value="true" disabled="disabled">
The field is boolean .I am getting its value in action class as true from model object..but still its unchecked.
Update:
I tried this but its not compiling
<s:checkbox theme="simple" style="border:0px" key="eDir" disabled="true" <s:if test='${eDir}' >checked="checked"</s:if>></s:checkbox>
Update1:
I tried this but there is no checked attribute so it is not checked despite its value being true
<s:checkbox theme="simple" style="border:0px" key="eDir" disabled="true" value="%{#eDir}"></s:checkbox>
Update2:
When I print, i.e. <c:out value="${eDir}"></c:out>
, I get the value as true
but the same I put it in the value attribute, it still doesn't have a checked attribute.
<s:checkbox theme="simple" style="border:0px" key="eDir" disabled="true" value="${eDir}"></s:checkbox>