如何在p:commandButton中存储值?

时间:2014-10-14 10:49:12

标签: jsf variables primefaces javabeans commandbutton

我想将p:commandButton中显示的值存储在辅助bean中的变量中。这是我的命令按钮。

<p:commandButton value="#{rec.UTILITY_BILL_UPLOAD}" actionListener="#{pavReqAssign.DownloadFile}" onclick="PrimeFaces.monitorDownload(start, stop);" icon="ui-icon-arrowthick-1-s" >
<p:fileDownload value="#{pavReqAssign.file}" />
</p:commandButton>

和我想要存储值的变量(即“#{rec.UTILITY_BILL_UPLOAD}”),是:

string fileNameDL;

1 个答案:

答案 0 :(得分:0)

尝试此操作,假设在托管bean fileNameDL中声明了属性pavReqAssign

<p:commandButton value="#{rec.UTILITY_BILL_UPLOAD}" actionListener="#{pavReqAssign.DownloadFile}" onclick="PrimeFaces.monitorDownload(start, stop);" icon="ui-icon-arrowthick-1-s" >
    <f:setPropertyActionListener target="#{pavReqAssign.fileNameDL}" value="#{rec.UTILITY_BILL_UPLOAD}" />
    <p:fileDownload value="#{pavReqAssign.file}" />
</p:commandButton>