Hi All,
I need Urgent help in
JSF, RichFaces, Jfree chart. I am new for these technolgies.
I am having form which is having some drop down menu and one submit button. Suppose I selected 'A' from dropdown this selection pass to
Java code based on which DAO layer will return row counts. This count is passed in Jfree Pie chart method to create a Pie chart. In UI I need to display this chart in second Panel of same Dropdown page. UI is developed with RichFaces. Code is as below for UI:
<h:form id="txnDashBoardDataForm" style="border:0">
<rich:panel>
<div align="center">
<a4j:commandButton value="View Chart" id="searchButton"
styleClass="controlButtonActive"
reRender="resultPanelId"
actionListener="#{dashboardCtrl.loadTxnCount}"
oncomplete="if(#{facesContext.maximumSeverity != null}){
#{rich:component('InfoMessagePopUp')}.show();
}else{ } " />
</div>
</rich:panel>
<a4j:outputPanel id="resultPanelId" ajaxRendered="true">
<rich:panel>
<a4j:mediaOutput style="width:200px;height:200px;" element="img"
cacheable="false" session="true" createContent="#{dashboardCtrl.loadTxnCounts}"
mimeType="image/gif" />
</rich:panel>
</a4j:outputPanel>
In above code in <a4j:commandButton> I used reRender attribute, which is having same id as given in <a4j:outputPanel id="resultPanelId" ajaxRendered="true">. If I am first time loading page then I can see Pie chart is coming on UI this is due to <a4j: mediaOutput createContent attribute where I am calling the function which is calling Chart creation function. But if I am selection one item from Drop down and then submitting the Form chart is not getting displayed. Though in console I can see Graph method is called, but then some Decode error is coming :
ERROR [[Faces
Servlet]] Servlet.service() for servlet Faces Servlet threw exception
javax.faces.FacesException: Error decode resource data
Please help me to know how I can display Pie chart after submitting form. As of now I only know that richfaces mediaOutput I can use. Please help on urgent basis.