Thanks for the heads up. I am learning both libraries right now. --Brad
-----Original Message----- From: Michael Jouravlev [mailto:[EMAIL PROTECTED] Sent: Tue 11/1/2005 2:32 PM To: Struts Users Mailing List Subject: Re: Question on http://displaytag.sourceforge.net/ On 11/1/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Has anyone used the display tag library at http://displaytag.sourceforge.net/ > in a Struts application? > > If so what did you think of it? These two listings print out items in a pageable table and have links for view, edit and delete operations. Compare and choose for yourself (the code may not be perfect, but it gives the idea). (1) Struts-EL + JSTL === cut here, start === <table width="100%"> <thead> <tr> <th>ID</th> <th>Str Value</th> <th>Int Value</th> <th>Link Actions</th> <th>Button Actions</th> </tr> </thead> <!-- Show item list --> <logic-el:iterate id="item" collection="${crudform.items}" offset="${crudform.offset}" length="${crudform.pagesize}" type="net.jspcontrols.dialogs.samples.crudaction.business.BusinessObj"> <html:form action="/crudactionlite.do"> <tr> <td><c:out value="${item.itemId}"/></td> <td><c:out value="${item.stringValue}"/></td> <td><c:out value="${item.intValue}"/></td> <td> <html-el:link href="crudactionlite.do?DIALOG-EVENT-VIEW&itemId=${item.itemId}">View</html-el:link> | <html-el:link href="crudactionlite.do?DIALOG-EVENT-EDIT&itemId=${item.itemId}">Edit</html-el:link> | <html-el:link href="crudactionlite.do?DIALOG-EVENT-DELETE&itemId=${item.itemId}">Delete</html-el:link> | </td> </tr> <html:hidden name="item" property="itemId"/> </html:form> </logic-el:iterate> </table> === cut here, end === (2.1) Displaytag-EL, JSP === cut here, start === <!-- Displaytag counts from 1, so adding 1 to zero-based crudform.offset --> <display:table name="${crudform.items}" offset="${crudform.offset+1}" length="${crudform.pagesize}" decorator="net.jspcontrols.dialogs.samples.crudaction.MyListDecorator"> <display:column property="itemId" title="ID" /> <display:column property="stringValue" title="Str Value" /> <display:column property="intValue" title="Int Value" /> <display:column property="operationsLinks" title="Actions" /> </display:table> === cut here, end === (2.2) Displaytag-EL, decorator === cut here, start === public class MyListDecorator extends TableDecorator { public String getOperationsLinks() { BusinessObj lObject= (BusinessObj)getCurrentRowObject(); String lId= lObject.getItemId(); return "<a href=\"crudactionlite.do?DIALOG-EVENT-VIEW&itemId=" + lId + "\">View</a> | " + "<a href=\"crudactionlite.do?DIALOG-EVENT-UPDATE&itemId=" + lId + "\">Edit</a> | " + "<a href=\"crudactionlite.do?DIALOG-EVENT-DELETE&itemId=" + lId + "\">Delete</a>"; } } === cut here, end === Note, that you may need to use something like HttpServletRequest.getServletPath() in a decorator to ensure the proper path to your action. Maybe you can return a string, containing Struts tags, I never tried that. DisplayTag can do much more than simple pageable tables, and it is an established library, used by many. Michael. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]