【问题标题】:How to update p:inputText from backing bean?如何从支持 bean 更新 p:inputText?
【发布时间】:2015-02-22 08:54:38
【问题描述】:

我想在业务逻辑完成后从 backing bean 更新<p:inputText>。 我在支持 bean prop1prop2 中有两个属性,对应的 UI 组件为 <p:inputText>。但是当我更新两个 ui 组件时,它们不会使用业务逻辑中的最新值进行更新。我尝试使用 p:ajax 和 RequestContext 进行更新,但两者都不起作用。

<p:inputText id="htmlDivs"
             style="display:inline"
             ajax="true"
             value="#{backingbean.deviceHtml}"/>

<p:inputText id="paths"
             style="display:inline"
             ajax="true"
             value="#{backingbean.connections}"/>

RequestContext.getCurrentInstance().update(Arrays.asList("myform:htmlDivs",
                                                  "myform:paths",
                                                  "myform:devicePortTable"));

奇怪的是devicePortTableis 更新了。有什么建议吗?

谢谢 布里杰什

【问题讨论】:

  • 你如何触发你的行动?
  • 这就是我在按钮单击时调用支持 bean
  • 您是否尝试删除 immediate ?并删除&lt;p:ajax&gt; ?
  • @Scorpion 解决了我的问题。拯救了我的一天。立即是罪魁祸首
  • 不客气,伙计。我将发布此解决方案以接受它。

标签: jsf primefaces


【解决方案1】:

尝试删除 immediate="true" 并删除 &lt;p:ajax&gt;,因为它没有效果,因为您的 &lt;p:commandButton&gt; 中已经有更新属性

 <p:commandButton id="reloadSVGBtn"
                  styleClass="pbutton"
                  value="Hidden"
                  actionListener="#{myform.reloadSVG}"
                  update=":topologyViewForm:htmlDivs :topologyViewForm:paths">  
</p:commandButton>

更多详情请阅读this

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-10
    • 1970-01-01
    • 2012-04-21
    • 1970-01-01
    • 1970-01-01
    • 2011-04-07
    相关资源
    最近更新 更多