【发布时间】:2014-06-24 11:26:00
【问题描述】:
我正在尝试在确认对话框消息中显示更新的值,但在这种情况下我不断获得旧值
<h:form>
<p:inputText value="#{bean.object.amount}"/>
<p:commandButton value="CALCULATE" update="cal" actionListener="#{bean.calculate()}"/>
<h:panelGroup id="cal">
<h:outputText value="#{bean.object.amount}"/>
<p:commandButton value="SUBMIT" actionListener="#{bean.submit()}">
<p:confirm header="Confirmation" message="Amount is : #{bean.object.amount} ?"/>
</p:commandButton>
<p:confirmDialog global="true">
<p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
<p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</p:confirmDialog>
</h:panelgGroup/>
</h:form>
豆码:
@ManagedBean(name="bean")
@ViewScoped
public class Bean implements Serializable {
private SomeClass object;
@PostConstruct
public void init(){
this.object = new SomeClass();
}
public void calculate(){
//do some colculation (not related to amount field in object)
}
public void submit(){
//submit to database
}
//getter setter
}
当我输入一个金额值时,假设为 50。然后更新 cal 组件,我在输出文本“50”中得到更新后的金额。但是,在确认按钮消息中,我得到的金额为 0 而不是 50。如何在确认消息中显示更新后的值?
PS: Primefaces-4.0
【问题讨论】:
-
我在您的确认对话框中没有看到任何消息??
-
你能展示一下你的backing bean吗?
-
@Makky 位于按钮内的确认组件中
-
@nosnhoj 我已经更新了我的问题,但我认为这是一个客户端问题。我在输出文本中得到了更新的值,但我没有在确认消息中得到它。
标签: jsf primefaces