Menu

Export options? Setting the filename...

Michael D
2004-03-09
2012-10-09
  • Michael D

    Michael D - 2004-03-09

    I love the tag -- its great!  I'm using it with my Struts/Tiles application and it works without any problems. 

    One thing I'd like to do, but not sure how to go about it -- is when using the export feature how do I set the filename to something?  (i.e. foobar.xls instead of mypage.jsp.xls as the default)

    Thanks,
    Michael

     
    • Nisha

      Nisha - 2004-09-03

      Hi Michael,

      Just wondering whether you were able to figure this out. I need to change the filename in my application, would be good if you've done it and can help.

      Thanks,
      Nisha

       
      • viswa

        viswa - 2007-02-01

        Please help me . i also want to change the file name

         
    • Michael D

      Michael D - 2004-09-03

      No, I haven't seen anyone respond and I tried doing what the docs said...

      Sorry!

       
    • Nisha

      Nisha - 2004-09-06

      No worries. Thanks anyways.

       
    • Thierry LER

      Thierry LER - 2007-02-02

      Hi.

      You can change the value in the "displaytag.properties" file and/or in you JSP.

      If you want the same name for all your tables, set the "export.excel.filename" property in the "displaytag.properties" file.

      Ex:
      export.excel.filename=my_file_name.xls

      If you want a specific name by table, then change it in the JSP, using the <display:setProperty .../> tag.

      Ex:
      <display:table
      onclick="produitInitAction.do" mode="co"
      name="alpha" defaultsort="1" sort="list" defaultorder="descending"
      pagesize="15" export="true" requestURI="listeProduitValiderAction.do"
      decorator="fr.generali.fede.icone.web.displaytag.TableDecoratorIcone">

      &lt;display:setProperty name=&quot;export.excel.filename&quot; value=&quot;produits.xls&quot;/&gt;
      
      &lt;display:column property=&quot;codeProduit&quot; title=&quot;Code&quot; sortable=&quot;true&quot; headerClass=&quot;sortable&quot; /&gt; 
      &lt;display:column property=&quot;libelleProduit&quot; title=&quot;Libellé&quot; sortable=&quot;true&quot; headerClass=&quot;sortable&quot;/&gt;
      

      </display:table>

      You can change both: one default name for all tables and one specific name when needed.

      Th.

       
      • Robert

        Robert - 2007-06-28

        I did exactly what you said and it does not work for me at all. Instead of using the filename specified in the setProperty tag (data.xls or data.csv), it uses the value in the requestURI. I can not figure out it at all. Please help!

        here is my jsp:

        <display:table name="${result}" id="result" class="ApptableDisplayTag" export="true" requestURI="/searchResults.do" pagesize="2">
        <displaytag:setProperty name="export.excel.filename" value="data.xls" />
        <displaytag:setProperty name="export.csv.filename" value="data.csv" />
        <display:caption>This is the table caption</display:caption>
        <display:column sortable="false" title="Keys of Defective Records"> <c:out value="${result}"/></display:column>
        </display:table>

         

Log in to post a comment.