0

First, my code:

report-layout.xhtml:

<ui:define name="content">
    <h:panelGroup id="reporte-viewer" layout="block" >
        <p:media value="#{reportBean.file}" player="pdf" width="500px" height="400px">
            NO SUPP!!!
        </p:media>
    </h:panelGroup>
</ui:define>

index.xhtml:

<ui:composition  xmlns="http://www.w3.org/1999/xhtml"
             ..............
             template="/WEB-INF/template/layouts/report-layout.xhtml">

    <ui:param name="reportBean" value="#{myBean}" />

</ui:composition>

I tested MyBean with ViewScoped and SessionScoped, the next code is returning null when I use getValue:

PrimeResourceHandler.java:

String dynamicContentEL = (String) session.get(dynamicContentId); //read: "#{reportBean.file}" replacing with "#{myBean.file}" works.
ELContext eLContext = context.getELContext(); //OK
ValueExpression ve = context.getApplication().getExpressionFactory().createValueExpression(eLContext, dynamicContentEL, StreamedContent.class); //Apparently OK
streamedContent = (StreamedContent) ve.getValue(eLContext); //return null

Why when I pass MyBean like param getValue return null, JSF resolve "#{reportBean.file}" without problem, but the before code doesn't work.

wsaca
  • 55
  • 11
  • This question is very confusing. I'm not exactly sure what you're asking. Can you try to rephrase the qusetion? – Catfish Jul 25 '12 at 15:28
  • Ok, in the 'index.xhtml' file I'm passing a param to 'report-layout.xhtml' using ui:param, all is working (JSF recover the param value, in this case the reference to MyBean class (ManagedBean)), but when Primefaces (p:media) try to read the EL expression #{reportBean.file} programmatically it is getting a null value, I think the #{reportBean.file} must be translated to #{myBean.file}. I pasted the lines in 'PrimeResourceHandler.java' for your understanding. – wsaca Jul 26 '12 at 13:18
  • Maybe we can't resolve EL expressions what depends of a facelets param, I can't get a FaceletsContext reference from the ResourceHandler, I changed the PrimeResourceHandler and MediaRenderer to fix this problem. I don't why this happens... – wsaca Jul 26 '12 at 14:25

0 Answers0