Question

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 have 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

Was it helpful?

Solution

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}"

OTHER TIPS

Try doing:

fieldValue="<s:property value= "${id }"  />"

or

fieldValue="<s:property value=<c:out value="${id }"/>   />"

this will require:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top