Yes! The change to source code will be in TableTag.java.
The code snippet below for TableTag changes looks okay.
Call to jsp is not. It should be...
<display:setProperty name="export.csv.filename" value="thefilename.csv" />
Set the value to the name of the file you want.
Also, it will be a good idea to initialize that property (export.csv.filename) in the loadDefaultProperties() method. Otherwise, you might end up getting a null pointer exception at runtime, which will be really hard to track.
HTH,
--ajay
"Mehta, Jasmin" <[EMAIL PROTECTED]> wrote:
Thanks Ajay.When you say that have to modify the source code, it means modify at only file TableTag.java?In doEndTag() of TableTag.java, if I add lines like below, in existing try-catchtry
{
// out.clearBuffer();
// out.clear();
if(exportType == 1)
{
res.setContentType(prop.getProperty("export.csv.mimetype"));
fileName = prop.getProperty("export.csv.filename"); // new code
res.setHeader("Content-Disposition", "attachment;filename=" + fileName); // new code
out.write(buf.toString());
out.flush();
} else
if(exportType == 2)
{
res.setContentType(prop.getProperty("export.excel.mimetype"));
out.write(buf.toString());
out.flush();
} else
if(exportType == 3)
{
res.setContentType(prop.getProperty("export.xml.mimetype"));
out.write(buf.toString());
out.flush();
}
returnValue = 5;
}and in JSP<display:setProperty name="export.csv.filename" value="false" />
It should work?
Anywhere else, modification required?
Pl confirm this ASAP.
Thanks a lot in advance.
Jasmin
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Ajay Koranne
Sent: Tuesday, June 15, 2004 10:38 AM
To: [EMAIL PROTECTED]
Subject: Re: [displaytag-user] how to change default extension from '.jsp' to '.csv' for CSV Export?For 0.8.6 tag library, you will have to change the source code.I added new properties "export.csv.filename", "export.excel.filename".Modify doEndTag() to add...
fileName = prop.getProperty("export.csv.filename");
res.setHeader("Content-Disposition", "attachment;filename=" + fileName);
Make sure to initialize the property values in your jsp call.HTH,
--ajay
"Mehta, Jasmin" <[EMAIL PROTECTED]> wrote:Hi,
I am using version 0.8.6 of display-tag library. Right now when I click on link 'CSV' and try to save it, its taking the default saving file name as myreport.jsp (whatever the JSP file name where the display-tag is being used).
How can I change this default file name that is coming upon saving the file to the new extension .csv?
Pl help me, this is very urgent.
Thanks
Jasmin
-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
_______________________________________________
displaytag-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-user
Ajay S. Koranne, ceo
SUSWATI TECHNOLOGIES INC.
www.suswati.net
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
Ajay S. Koranne, ceo
SUSWATI TECHNOLOGIES INC.
www.suswati.net
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.

