f:param仅在多个commandButtons中使用相同名称时才第一次使用

时间:2015-10-09 04:58:33

标签: jsf-2 primefaces download parameter-passing

我的需求是上传一些数据并生成不同的报告,只需点击一下即可下载。在下面的示例中,我显示了相应的按钮,该按钮具有一个参数,该参数被发送到下载bean以选择正确的报告版本。

f:param仅在第一次执行p:commandButton时设置,然后对其他按钮保持不变。为什么会这样,我该如何解决这个问题?

<h:form id="mainForm" enctype="multipart/form-data">
   <p:fileUpload ...../>
   ....
   ....
   <p:selectBooleanCheckbox id="opt1"
      <p:ajax event="change" update="hiddingPanel"/>
   </p:selectBooleanCheckbox>

   <p:selectBooleanCheckbox id="opt2"
      <p:ajax event="change" update="hiddingPanel"/>
   </p:selectBooleanCheckbox>

   <h:panelGroup id="hiddingPanel">
      <p:commandButton id="doOpt1" rendered="#{bean.opt1 and !bean.opt2}"
         actionListener="#{bean.readFile}" ajax="false" />

         <p:fileDownload value="#{downloadBean.content}" />
         <f:param name="reportType" value="REPORT1"/>

      </p:commandButton>

      <p:commandButton id="doOpt1" rendered="#{!bean.opt1 and bean.opt2}"
         actionListener="#{bean.readFile}" ajax="false" />

         <p:fileDownload value="#{downloadBean.content}" />
         <f:param name="reportType" value="REPORT2"/>

      </p:commandButton>
   </h:panelGroup>
</h:form>

感谢您的任何建议!

问候。

0 个答案:

没有答案