Currently i am using jsf2, primefaces 4 and omnifaces in my report project.
I have jsf form with as follows:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core" >
<ui:composition template="/templates/reportLayout.xhtml">
<ui:define name="centerContent">
<h:form>
Parameter 1: <p:inputText />
Parameter 2: <p:inputText />
Output Type:
<p:selectOneMenu>
<f:selectItem itemValue="html" />
<f:selectItem itemValue="pdf" />
</p:selectOneMenu>
<hr/>
<p:commandButton value="Generate Report"
action="#{reportBean.generate}" />
</h:form>
<p:outputPanel id="output">
<p:lightBox iframe="true">
</p:lightBox>
</p:outputPanel>
</ui:define>
</ui:composition>
</html>
Based on the parameters, reportBean.generate method will generate either pdf response or html response from the reportBean as follows.
> res27: String = application/pdf
> res28: Array[Byte] = Array(37, 80, 68, 70, 45, 49, 46, 54, 13, 10, 57, 32, 48, 3
2, 111, 98, 106, 13, 10, 60, 60, 47, 84, 121, 112, 101, 47, 88, 79, 98, 106, 1
01, 99, 116, 47, 83, 117, 98, 116, 121, 112, 101, 47, 70, 111, 114, 109, 47, 7
, 119, 51, -30,...
How do i display the response in the output panel ?