这是以下问题的精确副本: How to provide a file download from a JSF backing bean?
除了我试图使用不同的面孔之外,所描述的方法也不起作用。
注意:我不能使用
使用时 - 文件下载正常。
<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">
我正在尝试使用并且页面刚刚刷新,我不知道它是否为请求启用了ajax,但答案中描述的方法不起作用。
这是我的对象代码:
<af:commandMenuItem text="Test" id="cmi2389"
rendered="true"
actionListener="#{pageFlowScope.InkassPorReportBean.dlw}"
partialSubmit="false" immediate="true">
</af:commandMenuItem>
如果我将内容长度设置为文件大小,我也会收到以下错误,如果我没有设置响应大小,则不会发生这种情况:
<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)
>
请求被触发:
POST /sxdocs_XversionX/faces/main.jsf?Adf-Window-Id=w0&Adf-Page-Id=1 HTTP/1.1
pageFlowScope.InkassPorReportBean.dlw:是执行文件下载过程的支持bean中的动作侦听器方法,如另一个问题的答案所示。