[英]JSF selectOneButton with ajax update - setter 2 times invoked
[英]JSF selectOneButton with ajax update lost value
我将Primefaces 3.2与WebSphere Application Server 8上的Apache Myfaces 2一起使用。
我有一个窗体,您可以通过更改selectOneButton来选择2个不同的视图。
当我使用此按钮而没有ajax行为时(使用命令按钮提交),则值更改正常。
但是当我使用这样的东西:
<h:form id="form">
<p:panel header="Panel" toggleable="true" closable="true" id="pan1">
<p:panel header="Options" toggleable="true" collapsed="true" id="pan2">
<p:panelGrid style="width:100%; text-align:center;" id="pan3">
<p:row>
<!-- some outputLabels -->
<p:column rowspan="2" style="width:130px;">
<p:splitButton value="Show" action="#{ graph.update }"
update=":form" id="splitbtn">
<p:menuitem value="Update 2"
action="#{ graph.update2 }"
update=":form" />
</p:splitButton>
</p:column>
</p:row>
<p:row>
<p:column>
<p:selectOneButton id="btn1"
value="#{ bean.val }">
<f:selectItem itemLabel="lbl1" itemValue="1" />
<f:selectItem itemLabel="lbl2" itemValue="2" />
<p:ajax event="change"
update=":firstChartForm" />
</p:selectOneButton>
</p:column>
<!-- more coloumns -->
</p:row>
</p:panel>
<!-- more content -->
</p:panel>
</h:form>
然后,当我更改按钮并使用ajax更新表单时,bean.val的值为空。 (设置方法中的记录器将打印2倍的空值)。
为什么值是空的?
这是PrimeFaces selectOneButton错误。 PrimeFaces 3.4修复
链接到问题跟踪器中的问题3767:
http://code.google.com/p/primefaces/issues/detail?id=3767
此问题已在PrimeFaces 3.4版中修复。
每当您有这种行为时,就意味着未正确指定某些更新。 尝试整体使用update =“ @ form”。 为此目的使用SelectOneButton有点少见,您也可以使用TabView来实现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.