Discussions

News: Discussion: My favorite J2EE component is ... DisplayTag

  1. There was a thread a while back on TSS about lack of J2EE components. There are a lot of good visual JSP tags, my favourite being the <display:*> tag library, an open source table renderer that handles the displaying of columns, sorting, paging, cropping, grouping, exporting, smart linking and decoration of the table in a nice and customizable xhtml style.

    Check it out at:
    http://displaytag.sourceforge.net.

    You can see live examples here:
    http://www.displaytag.org/index.jsp.

    It is awesome, simple, powerful!

    Here you can also view my live example:
    http://basebeans.com/do/channelsPg.

    So if this is not a component, what is?
    What is your favorite tag?

    Threaded Messages (33)

  2. DisplayTag is good[ Go to top ]

    I agree that the displayTag is really sharp and easy to implement. I had no problem handling my ArrayList of 400+ objects; however I will complain that it doesn't seem to possess the ability to sort against multiple columns, transform data prior to export, or allow for allow for list filtering (ie by alpha, date, etc.) like you might get via a struts logic:match tag.
  3. Its great for look n feel and simple stuff.
    1. Can it support array or vector instead of the list.
    2. nesting of tables looks ugly as in it has some java code inside the name tag to get hold of the sub list. any other better ways to nesting ???
  4. How about RowSets ?[ Go to top ]

    This tag looks really good, but I wonder if it works with a CachedRowSet. After all, having a long list of value objects that where just pulled out of the database doesn't make a lot of sense (Data Transfer RowSet pattern).

    Cheers
  5. Our favorite is Coldtags suite:
    www.servletsuite.com/jsp.htm

    This suite actually saved some of our clients from ASP.NET :)
  6. Our favorite is Coldtags suite:

    > www.servletsuite.com/jsp.htm
    >
    > This suite actually saved some of our clients from ASP.NET :)

    Thanks! Coldtags has a DataList tag that supports ResultSets.
  7. Does it work yet with MVC/Struts?[ Go to top ]

    Ed Hill presented at a BOF at JavaOne '02 and showed this tag he came up with. It was truly awesome. I came home and devoured it and found that my big problem was it was tough to integrate into a Struts environment. Forget about Tiles... It was great with your JSP that posts to itself directly, but if that wasn't what you were doing, it became extremely difficult to leverage for sorting, exporting, etc. since these functions post back to the display page with parameters.

    At the time it wasn't on SourceForge and Ed wasn't replying much to his email. Has anybody that used the latest version tried to use it with Struts/Tiles? If I remember right it was also very difficult to use more than one table on a page since the display parameters had hardcoded names...

    My comments may be outdated, so I'd love to hear if it's something I should go back and look at...

    Joe
  8. Ed Hill presented at a BOF at JavaOne '02 and showed this tag he came up with. >It was truly awesome. I came home and devoured it and found that my big problem >was it was tough to integrate into a Struts environment. Forget about Tiles... >It was great with your JSP that posts to itself directly, but if that wasn't >what you were doing, it became extremely difficult to leverage for sorting, >exporting, etc. since these functions post back to the display page with >parameters.

    >
    > At the time it wasn't on SourceForge and Ed wasn't replying much to his email. >Has anybody that used the latest version tried to use it with Struts/Tiles? If >I remember right it was also very difficult to use more than one table on a >page since the display parameters had hardcoded names...

    Yes, it does work with the Struts and Tiles. You need to use the requestURI attribute (http://displaytag.sourceforge.net/faq.html#action).

    The biggest news of late is the introduction of the current (row) item as a scripting variable, so custom formats (like dates) can be implemented right in the displasy:column body.

    I've found the export functionality to super slick; just say export="true" and your users can download the table directly as a spreadsheet.
  9. It's been a year and a half, so my memory is rusty here, and I think the requestURI solved some of the problem, but don't some of the functions default to invoking the current JSP? I think the export would by default invoke the current JSP page name to pass in a different parameter instead of being allowed to specify it. Maybe the paging mechanism and sorting suffered from this problem as well? Hopefully all this works fine now.

    I didn't think there was compatibility problems with Struts/Tiles tags or anything like that, just that, well, it assumed too much about the environment it was living in. I'll definitely revisit it though. I always did think this was an awesome tag!

    Joe
  10. Sorting and paging work fine.

    The export thing is a little different; the trouble is that the tag needs to reset the content type and clear all previous pages, despite being in the middle of an included page, which as you can imagine, is a mess. That said, there are several fixes that have been/are being discused on the dev list. You can watch the issue at http://sourceforge.net/tracker/index.php?func=detail&aid=820763&group_id=73068&atid=536613


    andy
  11. Comparison with struts HTML Tag ?[ Go to top ]

    This looks pretty good - how easy is it to incorporate form fields into the table as per the struts HTML tag library ?

    http://htmltable.yuriy-zubarev.com/customerListEditable2.do

    This library certainly seems to require a lot less setup in struts config, etc.

    Also, how easy is it to change the CSS classes used for background colours, table lines, etc.. ?
  12. My Favourite - JSP Tree Tag[ Go to top ]

    The Display Tag looks cool, I'll have to play around with it some day.

    I haven't used that many different off-the-shelf J2EE components yet, so
    until now, one of my favourite J2EE components (apart from the Struts stuff) is a JSP Tree Tag library I developed to make it easy to display trees in JSP pages (I have often needed that!). It's features are:

     - The tree is generated as normal HTML
     - it's 100% customizable in looks, and all customization is done in the JSP
       (no magic/hidden classes etc.) It can look just like the windows explorer
       tree if you want (check the demo).
     - works well with Struts
     - has good support for lazy building of the tree model on the server side
       (model and view are of course separated).
     - Is released under the LGPL, so it's free for commercial as well as
       noncommercial use.

    If you need trees in JSP pages that chnages often, or that are too big to be rendered as JavaScript tree, the JSP Tree Tag is a good alternative.

    Check it out here:

    http://www.jenkov.dk/projects/treetag/treetag.jsp
  13. Looks good[ Go to top ]

    Why don't the two tags table and tree join hands...
  14. Works great w/ Struts[ Go to top ]

    It works great w/ Struts, ex:
    http://cvs.sourceforge.net/viewcvs.py/basicportal/bPproj/bP/WEB-INF/pgs/forums/ArticleLst.jsp
    I would say it works best w/ Struts, and about 40% of my Struts pages have the display tag on it.
    (Struts is just a controller/action, you can/should use it w/JSTL also).
    For some frameworks, you may need a adapter from map to list, etc.

    RowSet (which is not MVC in View layer) has a toCollection method AFAIK, so I assume you know how to get from Collection to a List? (Again, in Struts, this is easy. But why are people still coding to JDBC when we have wonderfull DAO's???)

    .V
  15. Works great w/ Struts[ Go to top ]

    RowSet (which is not MVC in View layer) has a toCollection method AFAIK, so I assume you know how to get from Collection to a List? (Again, in Struts, this is easy. But why are people still coding to JDBC when we have wonderfull DAO's???)

    >
    > .V
  16. Works great w/ Struts[ Go to top ]

    RowSet (which is not MVC in View layer) has a toCollection method AFAIK, so I assume you know how to get from Collection to a List? (Again, in Struts, this is easy. But why are people still coding to JDBC when we have wonderfull DAO's???)

    >
    > .V

    Check Floyd's EJB Design Patterns, Data Transfer RowSet. ;) He explains better than I do, but basically converting a RowSet to an array of DTO just for displaying is a waste.
  17. Wow i never knew this existed[ Go to top ]

    I am going to try it. Always needed something like this.

    Well done guys.
  18. I have used the display tag with struts framework. It works fine.
    You can use decorator for additional functionality
  19. My favorite component is FileUpload in Jakarta Commons. It's a very userful tag and saved lot of time.

    Next time when I need to a report or a table presentation, I will definitly consider <display:*>.

    -----------------------------------------
    http://JavaRSS.com
    Just one bookmark - for all java related news, articles and blogs.
    -----------------------------------------
  20. 1 more vote for DisplayTag. Perfect!!!
  21. great work.. that fits exactly to almost all my requirements.just one question
    Can we choose the list of columns to be displayed in the table. For eg:there are 20 columns and the user wants to view only 7 columns of his/her choice out of 20. Is it doable with this taglib?
  22. I just took a look at this DisplayTag and it's fantastic. Thanks
  23. displaytag + struts[ Go to top ]

    Very usefull tag. But when you use struts you can't do something like this:

    display:column property="fullName" sort="true" width="15%"
             title='<%=resources.getMessage("userForm.fullName")%>' />

    and i dont want to hardcode the column's title on the jsp file

    Ignacio
  24. Yes, you can[ Go to top ]

    Use something like:
    <bean:define id="myTitle">
    <bean:message key="userForm.fullName"/>
    </bean:define>
    And then:
    <display:column ... title='<%=myTitle%>'>
  25. Great tag![ Go to top ]

    That's exactly what I was looking for!

    Great tag!
  26. Cewolf worth a mention[ Go to top ]

    Although DisplayTag is my favorite, somebody has to give honorable mention to cewolf. You get decent looking graphs and charts on your site for minimal effort, with hardly any configuration hassle or learning curve. It's a nice package.

    http://cewolf.sourceforge.net for more details.
  27. If too much data to save in session?[ Go to top ]

    it seems good
    but it require to save all data in session
    if I have 1 million rows
    It is too large to save all data in session
    how to do paging the result?
  28. This is possible with HTMLTable[ Go to top ]

    I've been looking at the HTMLTable taglib: http://htmltable.yuriy-zubarev.com/jsp/index.jsp which can passes along parameters so you can do the sorting and paging in your action using OJB or Hibernate. I like the look of Display a little better though, so I might use it if it can do it also. Does anybody know if it can do this?
  29. HELP ON HTMLTABLE component[ Go to top ]

    I'am agree, HTMLTABLE is fine but i have a trouble to understand very well the process to load data. I would like to use it with Oracle Database table.
    I have seen help on author site, it's not very large and i asked questions at the authors but no response arrive !!!
    Please if you have somes mores informations about htmltable, don't hesitate
    thanks !
  30. displaytag - Help needed[ Go to top ]

    I found display tag to be very useful in manipulating tables.

    I would like to know if displaytag can be used to sort the entire list when
    paging is used.

    Also, I found that HTMLtag tables can display checkboxes for each row easily.
    Is there any method of doing so using the displaytag?
    Thanks,
    Deepa
  31. checkboxes in displaytag[ Go to top ]

    Try this:

    <html-el:form action="/out_PrintShippingLists?action=print">
    <display:table name="sessionScope.ShippingList" id="currentObject" defaultsort="1">
        <display:column title="Print" nowrap="true" >
    <html-el:multibox property="itemsToPrint" value="${currentObject_rowNum}" />
        </display:column>
        <display:column property="destination" sortable="true" headerClass="sortable" />
        <display:column property="dynamicLocationId" sortable="true" headerClass="sortable" />
    </display:table>
    <c:if test="${showPrintButton}">
    <html-el:submit value="Print" />
    </c:if>
    </html-el:form>
  32. I used the DisplayTag till I ran into ValueList. The ValueList is a little more complex than DisplayTag, but it is way more powerfull.

    Check it out at:
    http://valuelist.sourceforge.net
  33. uitags[ Go to top ]

    Disclaimer: I am one of uitags developers.

    We got tired of having to create user-unfriendly forms (due to tight project deadlines) so we wrote a set of reusable tags that addresses some of the most common annoyances in web UI including:

    1. Webapps that log users out on session timeout without warning, causing them to lose the text they've just finished typing.

    2. Select boxes (combo boxes) that contain way too many values to select from. These things are difficult to use. Imagine you are using a small select box to select 5 values out of 300. You've got to scroll to find an entry (not easy!), press Control, click the entry to highlight it, and repeat this 4 more times. If you forgot to press Control, you'll have to repeat all over again!

    3. Complicated forms that don't provide visual guide by disabling (graying out) irrelevant input fields.

    Here's the project homepage:
    http://uitags.sourceforge.net/
  34. Displaytag and Maps[ Go to top ]

    Does anybody know how to display a Map of objects of type LabelValueBean?

    Say, I have an ArrayList documentList which I would like to display on a page. Each document has a path, a title and Map called properties.

    The properties map may have several items in it depending on the document. But what I only need to display on the page are dateModified, dateCreated and owner.

    I've started with:

    <display:table id="document" name="documentList">
        <display:column property="title" />
        <display:column property="path" />

     <!-- I need to display the map here --->
    </display:table>

    Thanks in advance.