csv is taking .jsp extension while export

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • megha

    csv is taking .jsp extension while export

    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
  • Jeff Schwab

    #2
    Re: csv is taking .jsp extension while export

    megha wrote:
    [color=blue]
    > 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.[/color]

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

    Comment

    • megha

      #3
      Re: csv is taking .jsp extension while export

      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 <jeffplus@comca st.net> wrote in message news:<YtudnYTR8 I_XA-_d4p2dnA@comcas t.com>...[color=blue]
      > megha wrote:
      >[color=green]
      > > 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.[/color]
      >
      > For most servlet engines, just provide some <servlet-mapping>'s in your
      > application's web.xml file.[/color]

      Comment

      • Jeff Schwab

        #4
        Re: csv is taking .jsp extension while export

        megha wrote:
        [color=blue]
        > Jeff Schwab <jeffplus@comca st.net> wrote[color=green]
        >>[color=darkred]
        >>>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.[/color]
        >>
        >>For most servlet engines, just provide some <servlet-mapping>'s in your
        >>application 's web.xml file.[/color][/color]
        [color=blue]
        > 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[/color]

        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.

        Comment

        • Chris

          #5
          Re: csv is taking .jsp extension while export

          -----BEGIN PGP SIGNED MESSAGE-----
          Hash: SHA1

          megha wrote:
          [color=blue]
          > 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[/color]

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

          Content-Disposition: attachment; filename=<whate ver>.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)

          iD8DBQFAdiBsnwj A8LryK2IRAl3bAK DGUNPvWNdid7qfq 6dDQ36EkQC6HACf UgB3
          onb+lUmBZ5jKkVj rV/SUz1U=
          =WpUS
          -----END PGP SIGNATURE-----

          Comment

          Working...