0

首先,我的代码:

报告布局.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>

索引.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 return null 这样传递 MyBean 时,JSF 解析“#{reportBean.file}”没有问题,但之前的代码不起作用。

4

0 回答 0