This is an exact copy of the following question: How to provide a file download from a JSF backing bean?
Apart from I am trying to use different faces and the method described doesn't work.
Note: I cannot use
When using - file downloads fine.
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
I am trying to use and the page just refreshes, I dont know if it has ajax enabled for request but described methods in the answer do not work.
Here is my code for an object:
<af:commandMenuItem text="Test" id="cmi2389"
rendered="true"
actionListener="#{pageFlowScope.InkassPorReportBean.dlw}"
partialSubmit="false" immediate="true">
</af:commandMenuItem>
I also get following error if I set content length to file size, this doesnt happen if I response size is not set:
<Jun 9, 2015 7:37:14 PM MSK> <Error> <HTTP> <BEA-101083> <Connection failure.
java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '0' bytes instead of stated: '-1' bytes.
at weblogic.servlet.internal.ServletOutputStreamImpl.ensureContentLength(ServletOutputStreamImpl.java:463)
>
<Jun 9, 2015 7:37:14 PM MSK> <Error> <HTTP> <BEA-101104> <Servlet execution in servlet context "ServletContext@1243894494[app:sxdocs_XversionX module:sxdocs_XversionX path:null spec-version:3.0]" failed, java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '0' bytes instead of stated: '-1' bytes..
java.net.ProtocolException: Didn't meet stated Content-Length, wrote: '0' bytes instead of stated: '-1' bytes.
at weblogic.servlet.internal.ServletOutputStreamImpl.ensureContentLength(ServletOutputStreamImpl.java:463)
>
Request fired:
POST /sxdocs_XversionX/faces/main.jsf?Adf-Window-Id=w0&Adf-Page-Id=1 HTTP/1.1
pageFlowScope.InkassPorReportBean.dlw: is the action listener method in backing bean that executes file download procedure as shown in the answer to another question.
You need to use a fileDownloadActionListener something like this:
More references:
http://adfcodebits.blogspot.co.uk/2010/06/bit-19-downloading-file.html https://tompeez.wordpress.com/2011/11/26/jdev11-1-2-1-0-handling-imagesfiles-in-adf-part-2/