Paul Calhounから、必要なスプレッドシートを作成するためにマッサージしたサンプルコードが送られてきました。彼が何をしたのかはわかりませんが、今のところ、これがソリューションの核心であり、FileOutputStreamまたはByteArrayOutputStreamの代わりにOutputStreamを利用しているだけだと思います。
// The Faces Context global object provides access to the servlet environment via the external content
var extCont = facesContext.getExternalContext();
// The servlet's response object provides control to the response object
var pageResponse = extCont.getResponse();
//Get the output stream to stream binary data
var pageOutput = pageResponse.getOutputStream();
// Set the content type and headers
pageResponse.setContentType("application/x-ms-excel");
pageResponse.setHeader("Cache-Control", "no-cache");
pageResponse.setHeader("Content-Disposition","inline; filename=" + fileName);
//Write the output, flush the buffer and close the stream
wb.write(pageOutput);
pageOutput.flush();
pageOutput.close();
// Terminate the request processing lifecycle.
facesContext.responseComplete();
他の誰かがこの問題に遭遇した場合、私は喜んで助けを提供します、そしてうまくいけば、誰かが尋ねる時までに、私は何がうまくいったのかをもっと理解するでしょう....