struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject RE: Question on
Date Tue, 01 Nov 2005 21:51:35 GMT
Thanks for the heads up.  I am learning both libraries right now.


-----Original Message-----
From: Michael Jouravlev []
Sent: Tue 11/1/2005 2:32 PM
To: Struts Users Mailing List
Subject: Re: Question on
On 11/1/05, <> wrote:
> Has anyone used the display tag library at in a Struts
> 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%">
    <th>Str Value</th>
    <th>Int Value</th>
    <th>Link Actions</th>
    <th>Button Actions</th>

  <!-- Show item list -->
  <logic-el:iterate id="item"
  <html:form action="/">
      <td><c:out value="${item.itemId}"/></td>
      <td><c:out value="${item.stringValue}"/></td>
      <td><c:out value="${item.intValue}"/></td>
    <html:hidden name="item" property="itemId"/>
=== 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}"
  <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" />
=== 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=\""
+ lId + "\">View</a> | " +
href=\"" + lId +
"\">Edit</a> | " +
href=\"" + lId +
=== 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.


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message