a4j:mediaOutput not working with c:set and/or Facelets ui:pa
james.holder3 Apr 15, 2009 11:57 AMAll,
I'm trying to use a4j:mediaOutput to display a dynamically generated chart. I have it working when I explicitly define the bean the data is coming from (via createContent), however, when I attempt to generify the source location of hte data I receive the following error:
Servlet failed with Exception javax.faces.FacesException: Error decode resource data at org.ajax4jsf.resource.ResourceBuilderImpl.decrypt(ResourceBuilderImpl.java:618) at org.ajax4jsf.resource.ResourceBuilderImpl.getResourceDataForKey(ResourceBuilderImpl.java:360) at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:156) at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:141) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:484) Truncated. see log file for complete stacktrace java.util.zip.DataFormatException: incorrect data check at java.util.zip.Inflater.inflateBytes(Native Method) at java.util.zip.Inflater.inflate(Inflater.java:215) at java.util.zip.Inflater.inflate(Inflater.java:232) at org.ajax4jsf.resource.ResourceBuilderImpl.decrypt(ResourceBuilderImpl.java:612) at org.ajax4jsf.resource.ResourceBuilderImpl.getResourceDataForKey(ResourceBuilderImpl.java:360) Truncated. see log file for complete stacktrace
The code I use that works is as follows:
<a4j:mediaOutput id="gantt2" element="img" cacheable="false" session="false" createContent="#{sampleBean.outputChart}" mimeType="image/png"/>
When I try and generify this (and the problem shows up), I do the following:
Parent Page (this is withing a normal Facelets page):
<ui:include src="components/myData.xhtml"> <ui:param name="chart" value="#{sampleBean.outputChart}"/> </ui:include>
Source of "components/myData.xhtml":
<a4j:mediaOutput id="gantt2" element="img" cacheable="false" session="false" createContent="#{chart.outputChart}" mimeType="image/png"/>
Besides using ui:param (with facelets), this also fails using the same type of setting using c:set, so for instance:
<c:set var="chart" value="#{sampleBean.outputChart}"/>
My premise is that I've got the same type of chart, that I want to call twice, but provide it different data sets. So I create an instance of my chart generating class inside each bean, and then just include the display page in each different template.
I'm not sure why this isn't working. I've checked the object signatures, and they are different for each bean (ie, when in page 1 using bean1, the #{chart} is the correct object, the same for page2 bean2)
I'm not sure if I'm missing something or what here.
using jsf1.2
richfaces snapshot 3.3.1-20090228.050541-31 (due to bug in 3.3.0 regarding messaging from components w/ no id's)
facelets 1.1.14
Thanks for any suggestions