Question

In my Struts form I've got a list. In a JSP I iterate over it like this:

<c:forEach items="${MyForm.types}" var="type">
    <tr>
        <td>${type.name}</td>
        <td>${type.forced}</td>
        <td>${type.receive}</td>
        <html:checkbox property="type.receive" />
    </tr>
</c:forEach>

Now the <html:checkbox isn't working. I'm always getting the following error:

Caused by: javax.servlet.jsp.JspException: No getter method for property type.receive of bean org.apache.struts.taglib.html.BEAN

But actually there is a getter for this property in my form class. It's written like this:

public Boolean getReceive() {
  return receive;
}

When I remove the checkbox it's also possible to display the property as in the <td>-tag above so I don't know where the problem is.

Maybe I'm accessing it in the wrong way?

Was it helpful?

Solution 3

I'm now doing it like this:

<c:forEach items="${MyForm.testList}" var="testElement" varStatus="status">
    <html:checkbox property="testList[${status.count-1}].checkboxValue" />
</c:forEach>

Thanks to this question.

OTHER TIPS

All the individual properties type in struts Action form should be String.You have to define cbx_uebernehmen as String Type.

I think your getter method should look like this (is... instead of get...) :

public Boolean isCbx_uebernehmen() {
  return cbx_uebernehmen;
}

Should work like that. If it still doesn't, try changing return datatype from Boolean to boolean.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top