如何更新P:在Prime Faces中动态的输出标记值



我正在我的JSF项目之一中实现动态货币。我正在从后端获得货币的价值,并使用p:outputLabel将其设置在前端。有命令按钮,一旦单击,将更新特定字段中的所有数据。它当前正常工作,因为当我单击"确定"按钮时,它会更新所有输入字段,但没有更新输出标签。我尝试将其更改为h:outputText,但没有起作用,即使我尝试为标签创建ID并在p:commandbutton中更新ID,但没有起作用。以下是示例代码:

<p:commandButton id="okInfoAlert" value="Ok" rendered="#{bean.okId ne '' and bean.okId ne null}"
action="#{searchDetailsForNgIdService.setDataInokInfo}"
styleClass="button" onclick="closeAllAccordion()" 
update="custInfoPanelGridId, okInfoPanelGridId,okInfoService_ok_link_PanelGridID,okInfoPanelGrid" >

在此命令button的单击中,我们在后端调用了一个存储过程,该过程在FetchCurrencyBean类中设置了所选货币值中的货币值(下面给出)。

输出标签:

<p:outputLabel value="#{fetchcurrencyBean.selectedcurrency}"></p:outputLabel>

在这里,我尝试在单击CommandButton后立即动态更新OutputLabel值。它在重新加载页面后正在工作,但不动态更改标签

  1. 给出ID:outputLabel。
  2. 将此ID添加到P:CommandButton Update。
  3. 确保您已经为Selected -Currency创建了Getter和设置器
  4. 确保选定的货币不是空的。

最新更新