This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Struts and the fly likes How to use checkboxes in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to use checkboxes in struts" Watch "How to use checkboxes in struts" New topic

How to use checkboxes in struts

Andreas Bystrom
Ranch Hand

Joined: Mar 05, 2003
Posts: 32
Hi all!

I have some trouble with checkboxes and struts, and haven't been able to find a similar question on the forum yet.

My problem is that I get this error when trying to use a checkbox:
javax.servlet.ServletException: No getter method for property theForm.dataObj.isEnabled of bean org.apache.struts.taglib.html.BEAN

My code in the jsp page looks like this:
<td><html:checkbox property="thForm.dataObj.isEnabled"/></td>

I have checked so that I have a getter method for this object, and html:text is working fine from the same object. The get method returns a boolean, is that incorrect? Is it possible to "link" a checkbox towards a value like this?

The get method:

If anyone has an example of how they use checkboxes it would be great!

// Andreas
Consider Paul's rocket mass heater.
subject: How to use checkboxes in struts