views:

1060

answers:

1
+1  Q: 

struts checkbox

I am trying to set the fieldValue of the check box to a value i got from the property tag.

I am having trouble with the syntax

this is what I tried

<s:form id="myForm" method="post" action="removeUser" enctype="multipart/form-data">
     <s:iterator value="myList">
        <tr>
   <td><s:property value="id"/></td> 
   <td><s:property value="name"/></td> 
         <td><s:property value="email"/></td>
         <td><s:checkbox label="delete" name="delete" fieldValue="<s:property value='id'/>"/></td>
         </tr>
    </s:iterator>

    <s:submit id="saveForm" value="Delete users"></s:submit>
  </s:form>

However, it keeps on returning me "true" as the fieldValue

Can someone familiar with struts please help me?

Thanks

A: 

I don't think you can do that:

<s:checkbox label="delete" name="delete" fieldValue="<s:property value='id'/>"/>

fieldValue expects a OGNL expression. I did some Struts, not too much, you could try:

fieldValue="%{id}"

Alexandru Luchian