我需要以XML格式生成xml报告,但不能在文本视图中生成。 Current display
我的模态应该显示这样的东西。 As expected
我在reportdisplay.xhtml中编写了preRenderView bean.show()
XHTML:
<p:dialog header="Report Preview" modal="true" widgetVar="reportDialog"
maximizable="true" width = "800" height="500" resizable="false">
<iframe src="about:blank" name="iframe_a"></iframe>
<h:outputLink id ="rptDisp" value="reportdisplay.xhtml" title="Report Preview" target="iframe_a"/>
</p:dialog>
Bean:
public void show() {
FacesContext faces = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) faces.getExternalContext().getResponse();
response.setHeader("cache-control", "max-age=1");
response.setHeader("Pragma", "public");
response.setHeader("Content-Disposition", reportModel.getContentDisposition());
response.setContentType(reportModel.getContentType());
response.setContentLength(reportModel.getReport().length);
ServletOutputStream ouputStream = response.getOutputStream();
ouputStream.write(reportModel.getReport(), 0, reportModel.getReport().length);
ouputStream.flush();
ouputStream.close();
faces.responseComplete();
}
我能够在模式中的iframe中加载PDF视图,但不能以XML格式加载。