【问题标题】:PrimeFaces Composite Components: commandLink doesn't work in dataTablePrimeFaces 复合组件:commandLink 在 dataTable 中不起作用
【发布时间】:2014-07-29 14:07:25
【问题描述】:

'

<cc:implementation>
<p:outputLabel value="#{cc}"/>
<p>  <p:commandButton value="Vedi lista file" actionListener="#{cc.researchFileInDirectory}" update="panelFileLog"/></p>  

<h:panelGrid id="panelFileLog">

    <p:dataTable var="file" rendered="#{cc.viewFileList}" binding="#{cc.listaFile}">
        <p:column headerText="File" style="width:100px">
            <h:outputText value="#{file.toString()}" />
        </p:column>

        <p:column headerText="Link" style="width:100px">        
            <p:commandLink id="downloadLink" value="download" ajax="false" actionListener="cc.downloadFile">
                <p:fileDownload value="#{cc.file}" />
            </p:commandLink>
        </p:column>

</p:dataTable>

</h:panelGrid>
</cc:implementation>'

这个组件在这个页面中被调用

  <l:logFile />

它会加载文件列表,但是当我点击commandLink 时,它不会调用actionListener 方法而是将我重定向到同一页面。

【问题讨论】:

  • 发布用于托管控件的页面的 xhtml。确保您在 h:form 中,并且您的支持 bean 具有正确的范围和序列化。
  • 是的,它在 h:form 中;我没有 backing bean,因为 logFile 是复合组件,它不需要 backing bean;

标签: jsf jsf-2 primefaces


【解决方案1】:

使用StreamedContent 的每个组件都不能在复合组件中工作。更详细的解释请阅读http://jsfcorner.blogspot.be/2012/11/advanced-primefaces-graphic-image.html。由于&lt;p:fileDownload/&gt; 是其中之一,因此您不能使用它。

【讨论】:

    猜你喜欢
    • 2012-08-12
    • 1970-01-01
    • 1970-01-01
    • 2013-11-12
    • 1970-01-01
    • 2013-12-01
    • 1970-01-01
    • 2016-08-19
    • 2017-01-17
    相关资源
    最近更新 更多