By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,950 Members | 986 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,950 IT Pros & Developers. It's quick & easy.

csv is taking .jsp extension while export

P: n/a
Hi all

I am exporting some data in .csv format through jsp file it is
exporting the data in csv format but giving the exported file .jsp
extension.
I want .csv extension can anybody help.

Thanks

Megha
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
megha wrote:
I am exporting some data in .csv format through jsp file it is
exporting the data in csv format but giving the exported file .jsp
extension.
I want .csv extension can anybody help.


For most servlet engines, just provide some <servlet-mapping>'s in your
application's web.xml file.
Jul 17 '05 #2

P: n/a
Hi

I am exporting the data through .jsp file in three formats 1. excel,
2. xml
3. csv though for rest 2 it is exporting the data in same format with
proper extension but if i clicked .csv it is exporting in same format
but with.jsp extension. Tell me where exactly in web.xml i have to put
so that it will take the proper extension for all the exports file
without changing the formats of first two formats.

Thanks in advance

Megha
Jeff Schwab <je******@comcast.net> wrote in message news:<Yt********************@comcast.com>...
megha wrote:
I am exporting some data in .csv format through jsp file it is
exporting the data in csv format but giving the exported file .jsp
extension.
I want .csv extension can anybody help.


For most servlet engines, just provide some <servlet-mapping>'s in your
application's web.xml file.

Jul 17 '05 #3

P: n/a
megha wrote:
Jeff Schwab <je******@comcast.net> wrote
I am exporting some data in .csv format through jsp file it is
exporting the data in csv format but giving the exported file .jsp
extension.
I want .csv extension can anybody help.
For most servlet engines, just provide some <servlet-mapping>'s in your
application's web.xml file.

I am exporting the data through .jsp file in three formats 1. excel,
2. xml
3. csv though for rest 2 it is exporting the data in same format with
proper extension but if i clicked .csv it is exporting in same format
but with.jsp extension. Tell me where exactly in web.xml i have to put
so that it will take the proper extension for all the exports file
without changing the formats of first two format


Please don't top-post; posts are much easier to read when new content
goes below any old content to which it refers. :)

I understand now what you're trying to do. I'm afraid I don't have an
easy answer. You may find one in the reference material for your
server. One quick & dirty alternative would be to generate the content
(xml, csv or excel) to a static file, then provide a link or redirect to
that file. That approach may be undesirable for several reasons,
including security, but it is straight-forward.
Jul 17 '05 #4

P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

megha wrote:
Hi all

I am exporting some data in .csv format through jsp file it is
exporting the data in csv format but giving the exported file .jsp
extension.
I want .csv extension can anybody help.

Thanks

Megha


Hi,
How about, in your JSP, set the following header:

Content-Disposition: attachment; filename=<whatever>.csv

assuming you want the browser to do the typical open-or-save dialog.
The purpose of this syntax is to tell the browser, with the
"attachment" part, that the file should be saved and not opened
inline, and with the "filename" part, that the filename in the URL is
not the "real" filename of the object.

- --
Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAdiBsnwjA8LryK2IRAl3bAKDGUNPvWNdid7qfq6dDQ3 6EkQC6HACfUgB3
onb+lUmBZ5jKkVjrV/SUz1U=
=WpUS
-----END PGP SIGNATURE-----
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.