Checkbox with displaytag (5 messages)
- POSTED BY: Poorav Sheth
- POSTED ON: January 13 2006 15:11 EST
I am using Struts 1.2.7 and displaytag to display a list of objects. For example, I have an ArrayList (methodList) of objects (Method) that I need to display. For each row, I need to include a checkbox so that the user can select multiple records.
Here is an excerpt of the JSP code -
<html:form action="/search.do" method="post">
<display:table name="methodList" requestURI="" sort="list" class="results" id="table1">
<display:column title="<input type='checkbox' name='selectall' />" class="results"><html:checkbox property="methodName"></display:column>
<display:column property="methodName" title="Method ID" sortable="true" width="80" class="results"/>
<display:column property="methodDesc" title="Method Desc" width="120" sortable="true" class="results"/>
<display:column property="status" title="Status" width="80" sortable="true" class="results"/>
</display:table>
</html:form>
When I execute this page, it returns a blank page and the following error log -
javax.servlet.ServletException: No getter method for property methodName of bean
How do I pass a value from the html:textbox tag?Threaded Messages (5)
- Checkbox WITHOUT displaytag by Poorav Sheth on January 13 2006 17:02 EST
- Checkbox WITHOUT displaytag by Krishna Pothula on January 14 2006 09:47 EST
- Checkbox with displaytag by jochen Vriesema on February 10 2006 08:38 EST
- Checkbox with displaytag by L Rogero on March 02 2006 06:09 EST
- delete temp files by Dave Casserly on March 06 2006 09:03 EST
Checkbox WITHOUT displaytag[ GO TO TOP ]
- POSTED BY: Poorav Sheth
- POSTED ON: January 13 2006 17:02 EST
- in response to Poorav Sheth
I tried to implement checkbox without the displaytag and still ran into problems. Here is my code snippet -
<html:form action="/search.do" method="post">
<logic:iterate id="method" name="methodList" type="com.test.portal.projects.Method">
<table class="results" id="table1">
<tr>
<td width="10" class="sortable"><html:checkbox property="control" value="<%=method.getScheduleID()%>"/></td>
<td width="80" class="sortable"><bean:write name="method" property="methodName"/></td>
<td width="120" class="sortable"><bean:write name="method" property="methodDesc"/></td>
<td width="80" class="sortable"><bean:write name="method" property="acodeDesc"/></td>
</tr>
</table>
</logic:iterate>
</html:form>
I get a blank page and the following error log -
javax.servlet.jsp.JspException: ServletException in 'WEB-INF/user/SampleDetails.jsp': No getter method for property control of bean org.apache.struts.taglib.html.BEAN
What's happening here?Checkbox WITHOUT displaytag[ GO TO TOP ]
- POSTED BY: Krishna Pothula
- POSTED ON: January 14 2006 09:47 EST
- in response to Poorav Sheth
when you use property attribute (in your case "control") of HTML form elements, Struts tries to invoke getControl method of the FormBean associated to the Action.
If you have defined this method "getControl" in the Objects of methodList then your you have to use the id along with the property.
<logic:iterate id="method" name="methodList" type="com.test.portal.projects.Method">
<html:checkbox id="method" property="control" />
The action search.do is mapped to some Actionform in your struts-config.xmlCheckbox with displaytag[ GO TO TOP ]
- POSTED BY: jochen Vriesema
- POSTED ON: February 10 2006 08:38 EST
- in response to Poorav Sheth
This is a piece of code from one of our displaytag tables using a checkbox. This works for us.
Here is an excerpt of the JSP code
<display:table scope="request" name="specialCustomerForm.customerList" id="customerNo">
<display:column headerClass="tabel_header" title="" ><input class="input_check" type="checkbox" name="customerNo" value='<bean:write name="customerNo" property="customerNumber"/>'></display:column>
<display:column headerClass="tabel_header" title=" Customer No" property="customerNumber" />
</display:table>
hope this helpsCheckbox with displaytag[ GO TO TOP ]
- POSTED BY: L Rogero
- POSTED ON: March 02 2006 06:09 EST
- in response to jochen Vriesema
Hi,
Re: displaytag checkboxes, struts, & action class
I have a question regarding the post below.... My question is once I checked on any of the checkboxes in the displaytag how can i pass it to my Action class (via struts). Thanks!
From previous posts...
This is a piece of code from one of our displaytag tables using a checkbox. This works for us.
Here is an excerpt of the JSP code
<display:table scope="request" name="specialCustomerForm.customerList" id="customerNo">
<display:column headerClass="tabel_header" title="" ><input class="input_check" type="checkbox" name="customerNo" value='<bean:write name="customerNo" property="customerNumber"/>'></display:column>
<display:column headerClass="tabel_header" title=" Customer No" property="customerNumber" />
</display:table>
hope this helpsdelete temp files[ GO TO TOP ]
- POSTED BY: Dave Casserly
- POSTED ON: March 06 2006 09:03 EST
- in response to Poorav Sheth
Hi, i got this same problem with a checkbox too.
However, i made some changes and redployed and nothing happened.
I had to stop the server, delete the work/temp files and restart - and after this, it worked.
Thanks
Dave
Thursday, 11 April 2013
Struts Checkbox with displaytag
By Tech Zone 4 IT at 09:52
No comments
0 comments:
Post a Comment