File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes DisplayTag & Checkbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "DisplayTag & Checkbox" Watch "DisplayTag & Checkbox" New topic
Author

DisplayTag & Checkbox

YY Yong
Greenhorn

Joined: Apr 20, 2006
Posts: 3
Hi,

Does anybody know how to add checkboxes to a table column rendered by displaytag 0.8.5 ? how to make checkboxes to remain being checked after another column is sorted? If yes, please help!!

Thanks in advance.
Dhulipalla
Greenhorn

Joined: Aug 02, 2006
Posts: 4
Extend display tags column Decorator and use the same decorator class in the display tag column. In your class you can display the check boxes.

Your Jsp looks like
<display:table name="list" decorator="com.test.SearchResultsDecorator"> <display:column property="checkBox" headerStyleClass="columnhead lcell" title=""/>
</display:table>

Your Decorator Class Code looks like

public String getCheckBox(){
Content obj = (Content) this.getCurrentRowObject();
long checkboxValue=obj.getContentId();
String checkboxDisplay = obj.getContentName();

/* Any Such condition can be added here .....
if(checkInSelectedList(checkboxValue))
return disabledCheckBox(checkboxValue,checkboxDisplay).toString();
else
*/
return checkbox(checkboxValue,checkboxDisplay).toString();
}

private StringBuffer checkbox(long checkboxValue,String checkboxDisplay) {
return new StringBuffer().append("<input type='checkbox' name='"checkbox_name" value='").append(checkboxValue).append("'>");
}

Regards
Gopi
 
Don't get me started about those stupid light bulbs.
 
subject: DisplayTag & Checkbox
 
Similar Threads
How do we maintain the checkbox status while doing pagination in the display tag.
struts and role based content
Showing long list
Struts : display tag : column decorator
Getting Checkbox value - DisplayTag library