JSF解析像param一样传递的EL表达式(Facelets)

时间:2012-07-24 15:17:28

标签: jsf primefaces javabeans facelets param

首先,我的代码:

报告-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>

我使用ViewScoped和SessionScoped测试了MyBean,当我使用getValue时,下一个代码返回null:

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

为什么当我像Param getValue一样传递MyBean时返回null,JSF解决“#{reportBean.file}”没有问题,但前面的代码不起作用。

0 个答案:

没有答案