我的WebSphere Application Server 8JSF selectOneButton使用Ajax更新失去了价值
我有一个表格,您可以通过更改selectOneButton选择2个不同的视图上使用Primefaces 3.2与Apache MyFaces的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>
然后bean.val的值是空的,当我改变按钮和更新与阿贾克斯的形式。 (记录器在setter方法中打印2次空值)。
为什么值为空?
你的'bean'的作用域是否至少有'ViewScope'或更多? – Gaim 2012-07-13 07:29:05
是的,我的Bean是ViewScoped。 – veote 2012-07-13 08:02:53