How to make excel export using display tag library export my list/table?

Posted on 2007-10-12
Last Modified: 2013-11-24
Hi there,

I am trying to export to excel using the display tag library.

The data displays fine. However, when I click "Excel" export, it creates an excel file with the html code for the entire page but the data part is cut off.

QUESTION: using display tag library, how do I export only the table ( including the entire list regardless of paging) being displayed and not the entire html source for the page?

Appreciate all suggestions. Thanks!
Question by:cs_chick99

    Author Comment

    Increasing the points due to time crunch urgency
    LVL 26

    Expert Comment

    It's hard to offer general advice without seeing the example code which is breaking.

    Posted the code you are using (the key parts of it anyway, including required configuration settings), and perhaps part of the example wrong results.

    Have you checked your configuration, and the display tag documentation?
    LVL 24

    Expert Comment

    by:Tomas Helgi Johannsson

    In your web.xml config for the display tag lib try to change
    export.decorated from true to false.

       Tomas Helgi

    Author Comment

    TomasHeigl > did you mean to set this in the file or the web.xml? I tried it in the but the wrong export still occured.

    There is no "problem" code as there are no exceptions ever thrown. When trying to export, the export occurs "successfully" BUT instead of the data being exported, the html for the page is inserted into the excel file.

    --- ---
    export.banner=<div align="left">Export to: {0}</div>

    Everyhing works fine except that the export produces the wrong output.

    Expected: the data display in the table using the display tag library should be exported
    Actual: the actual html source for the entire page is being exported BUT without the data table.

    Is there anywhere else that explicit export setup needs to be done?


    Author Comment

    web.xml contains the export filter as given on Source Forge is as shown in comment above

    In the JSP:

    <display:table name="${}" class="fw_cssTable" id="leadsData" sort="list" export="true" pagesize="10" requestURI="/">
                    <display:column property="m_SalesLeadId" title="ID" class="fw_cssTableRow" headerClass="fw_csstableHeader" sortable="true" />
                    <display:column property="m_CustCompanyNm" title="Company name" class="fw_cssTableRow" headerClass="fw_csstableHeader" />

    Any suggestions for the cause of the data being exported incorrectly? All suggestions welcome! Thanks :o)

    Author Comment

    UPDATE: I realized that this error appears to be caused due to using Tiles.

    When I go to my tiled page, the export doesn't work properly.
    When I go directly to the jsp which contains the display tag, it xports correctly.

    Any suggestions please?
    LVL 26

    Expert Comment


    Author Comment

    mrcoffee365: yes I have specified the override filter in my web.xml...
    LVL 26

    Accepted Solution

    In that case, it sounds as if you have the configuration set up correctly.  Have you checked your logs for exceptions?

    If you do not find any exceptions, and the page produced does not give you any errors, just HTML with your desired spreadsheet data, then we cannot debug further without more information.  If you post the code which produces the page, and the resulting page, then we might be able to get further.

    In reading the displaytag forum, and other comments about Tiles, it seems clear that there are often problems producing an Excel file with the Tiles layer.  It might be that you will have to debug the Tiles code itself, or create the export page as a direct link to the JSP page rather than using Tiles.

    Author Comment

    The problem is with Tiles. Without using Tiles it works as per mrcoffee365's suggestion. Otherwise, I was unable to find a solution to use Tiles and have the excel export work.
    LVL 26

    Expert Comment

    It's good that it works in JSP, so you have a workaround.  I often find that the tag libraries have to be modified to do a specific task (although this is probably an actual bug, and not just a customization requirement).  There are a lot of benefits to open source products, but for the new tools, the extra debugging they require is the downside.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    matchUp  challenge 9 51
    Exe program is not a valid Win 32 application 15 74
    mapAB Challlenge 35 52
    Modeling a class in java 5 23
    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now