Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 942947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:21:16+00:00 2026-05-15T22:21:16+00:00

I have an requirement of generating two excel files at once. We are using

  • 0

I have an requirement of generating two excel files at once. We are using Apache POI for generating excel files and struts framework.

Within the action class, the steps are like,

OutputStream outputStream = response.getOutputStream();

and then populate data from db and created one file using POI and called,

response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition",
                 "attachment; filename=ExportFile1.xls");
workbook.write(outputStream);
outputStream.flush();

and followed same steps(populate data from db, write excel content) for second file as,

response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition",
                 "attachment; filename=ExportFile2.xls");
workbook.write(outputStream);
outputStream.flush();

But only one file is generated.

Is this possible in java to generate two files at once? Have anyone implemented this?

Pls note: Generating two sheets within one excel file is not required.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:21:17+00:00Added an answer on May 15, 2026 at 10:21 pm

    I have an requirement of generating two excel files at once.

    I had similar requirements, but this wasn’t to “generate with one click”, because if the user would be presented with “save as” dialogs for two or more files would be very confusing to the end-user.

    1. So there was a “generate” button, that would generate the files (with a progress bar if the procedure takes more time) and than redirect to another page (or popup) that would contain individual links of those multiple files, so the user could take them one by one, or only the desired ones.

    2. If the user still needs to get “with only one click” than zipping all files is the standard procedure. For more usability, that could be combined/improved with the screen or popup from scenario #1 : e.g. to show a list with checkboxes for each file, and a link at the bottom to “get all as a zip”. That way, the user could download individually files, but also select only the files is interested in, or simply just get all.

    This is how most webapps do it since it’s the most user friendly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the requirement of generating UML Diagrams for one of my C++ assignments.
I have the requirement of generating UML Diagrams for one of my C++ assignments.
We have a requirement to increase the functionality of a grid we are using
Once again I have hit the wall. How to replace escape characters using regular
I have a web application in Spring that has a functional requirement for generating
We have a requirement in project to store all the revisions(Change History) for the
I have a requirement to make a large amount of code MISRA compliant. First
I have a requirement to be able to provide a flex component in English
We have the requirement to take a form submission and save some data, then
I have a requirement to be be able to embed scanned tiff images into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.