Menu

Export data to Excel

Help
2008-02-16
2012-10-09
  • Nasrin Akhlaghi

    Nasrin Akhlaghi - 2008-02-16

    Hi,
    i ralise that his question has been asked and i have read all the posts, but
    still no luck.
    Im trying to export data to an excel file but do not succeed.
    I have locked at the examples
    , http://displaytag.homeip.net/displaytag-examples-1.1/example-export.jsp, but
    can not get it to work. The example shows exactly what i want to achive.

    Here is parts of my jsp code:

    <dt:table name="userVOList" id="uservo" cellspacing="0" export="true"
    requestURI="userSearch" cellpadding="2"
    decorator="com.teliasonera.wal.www.decorator.UserSearchDecorator">
    <dt:setProperty
    name="export.pdf.filename" value="example.pdf" />
    <dt:setProperty
    name="export.rtf.filename" value="example.rtf" />
    <dt:setProperty
    name="export.excel.filename" value="example.xls" />
    <dt:setProperty name="export.csv"
    value="false" />
    <dt:setProperty name="export.xml"
    value="false" />
    <dt:setProperty
    name="export.excel.class"
    value="org.displaytag.export.ExcelView" />

    As you can see i have set the "export" attribute to true and the Excel link
    appears
    at the end of my table in the jsp page.
    When I press the "excel link" I am redirected to the same page again!!
    What am I missing ?
    Do I need to configure something in my xwork.xml file or what ?
    I hav put this in my web.xml file:

    filter-name>ResponseOverrideFilter</filter-name>
    <filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>
    </filter>

    <filter-mapping>
    <filter-name>ResponseOverrideFilter</filter-name>
    <url-pattern>*.do</url-pattern>
    </filter-mapping>

    <filter-mapping>
    <filter-name>ResponseOverrideFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>

    What am i missing ?

     
    • kerem yazar

      kerem yazar - 2008-03-02

      try this at web.xml for filter mapping
      <filter-mapping>
      <filter-name>ResponseOverrideFilter</filter-name>
      <url-pattern>*.action</url-pattern>
      </filter-mapping>

       

Log in to post a comment.