Struts2: problem when assigning a value to a variable for a checkbox
I am working on struts2. In my jsp page, I want to assign the value of a string variable to a checkbox (when it is checked by the user). I have tried many times -
<% String code = "decompose"; %>
1) <tr><td>
<s:checkbox name="codeCkBox" fieldValue="%{‘code’}" onclick="submit()"/>
</td></tr>
2) <tr><td>
<s:checkbox name="codeCkBox" value="%{‘code’}" onclick="submit()"/>
</td></tr>
3) <tr><td>
<s:set name="setCkBoxValue" value="%{‘code’}"/>
<s:checkbox name="codeCkBox" fieldValue="# setCkBoxValue" onclick="submit()"/>
</td></tr>
But every time I tried to get this value by the name of the checkbox it returns the variable name ie "code". Looking for a solution. Thanks in advance.
a source to share