Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Little Problem

Little Problem

Scheduled Pinned Locked Moved Java
javahtmlsysadminhelpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    loveangel888
    wrote on last edited by
    #1

    Simple scenario: User goes to a web page, click a button, download the selected files. Problem: the problem is the files are all separate, I would like to zip them all up and let the user just press one button to save. the zip it self is simple, yet my files are excel generated by the jsp with html code

    response.setHeader("Content-Disposition", "attachment; filename=\"blah blah.xls\"");
    out.println(blah blah blah);

    So since it is generated all dynamically. Is there even a way to zip them up before they are downloaded. Or even generate excel on the server using these html way?

    T A 2 Replies Last reply
    0
    • L loveangel888

      Simple scenario: User goes to a web page, click a button, download the selected files. Problem: the problem is the files are all separate, I would like to zip them all up and let the user just press one button to save. the zip it self is simple, yet my files are excel generated by the jsp with html code

      response.setHeader("Content-Disposition", "attachment; filename=\"blah blah.xls\"");
      out.println(blah blah blah);

      So since it is generated all dynamically. Is there even a way to zip them up before they are downloaded. Or even generate excel on the server using these html way?

      T Offline
      T Offline
      TorstenH
      wrote on last edited by
      #2

      Change your point of view - zip the stuff and extract single files when needed. That's much simpler. regards Torsten

      I never finish anyth...

      L 1 Reply Last reply
      0
      • T TorstenH

        Change your point of view - zip the stuff and extract single files when needed. That's much simpler. regards Torsten

        I never finish anyth...

        L Offline
        L Offline
        loveangel888
        wrote on last edited by
        #3

        I'm sorry if i didn't explain it well enough. The point of the whole thing is to zip multiple dynamic generated files out, allowing the users to download the zip file in one click instead of the need to press multiple times to download multiple files.

        T 1 Reply Last reply
        0
        • L loveangel888

          I'm sorry if i didn't explain it well enough. The point of the whole thing is to zip multiple dynamic generated files out, allowing the users to download the zip file in one click instead of the need to press multiple times to download multiple files.

          T Offline
          T Offline
          TorstenH
          wrote on last edited by
          #4

          oh - ok, the files are created at runtime.. How to create a zip file with java.util.zip package[^] try this. regards Torsten

          I never finish anyth...

          1 Reply Last reply
          0
          • L loveangel888

            Simple scenario: User goes to a web page, click a button, download the selected files. Problem: the problem is the files are all separate, I would like to zip them all up and let the user just press one button to save. the zip it self is simple, yet my files are excel generated by the jsp with html code

            response.setHeader("Content-Disposition", "attachment; filename=\"blah blah.xls\"");
            out.println(blah blah blah);

            So since it is generated all dynamically. Is there even a way to zip them up before they are downloaded. Or even generate excel on the server using these html way?

            A Offline
            A Offline
            all_in_flames
            wrote on last edited by
            #5

            To get your proposed solution to work, you're on the right track by assuming you need to do all creation/zipping on the server side. Instead of having the jsp generate the excel files, have it done in a Servlet on your server side instead, based on parameters from the JSP page. You can then create the Excel files (likely by creating CSV files and renaming them, or using a third party library, such as JExcel (http://jexcelapi.sourceforge.net/[^]) and return the resulting .zip to the browser for download. Cheers!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups