The getoutputstream () has already been called for this response error is reported when you use POI in struts2 for Excel download. [go to]

Source: Internet
Author: User

 
In the project, the open-source jar for operating the Excel file poi is used.
 
Struts2 container management servlet is used in the project. Instead of simply using Servlet.
 
Workbook. Write (OS );
 
OS. Flush ();
OS. Close ();
 
Return "success ";
 
In my action, the final output is processed in this way. However, the following error occurs: Java. Lang. illegalstateexception: getoutputstream () has already been called for this response.
 
This is caused by calls between struts2 methods.
Because: each method returns an action object, while response is the action object parameter,
 
So it will cause a response conflict!
 
Therefore, change the final return "success" to return null.
No exception will be reported if it is not managed by sturts2.

The getoutputstream () has already been called for this response error is reported when you use POI in struts2 for Excel download. [go to]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.