struts2: problem in assigning a variable value to checkbox
Posted
by vivmal
on Stack Overflow
See other posts from Stack Overflow
or by vivmal
Published on 2009-05-15T04:40:05Z
Indexed on
2010/06/09
1:32 UTC
Read the original article
Hit count: 264
struts2
Hi All, 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 user). I tried it many times like -
<% 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 everytime when I tried to get this value by checkbox name it returns variable name i.e “code”. Looking for a solution. Thanks in advance.
© Stack Overflow or respective owner