Java 带有ajax更新的JSF selectOneButton丢失值

Java 带有ajax更新的JSF selectOneButton丢失值,java,ajax,jsf,jsf-2,primefaces,Java,Ajax,Jsf,Jsf 2,Primefaces,我在WebSphereApplicationServer8上使用PrimeFaces3.2和ApacheMyFaces2 我有一个表单,您可以通过更改SelectOne按钮来选择2个不同的视图 当我在没有ajax行为的情况下使用此按钮(使用命令按钮提交)时,值更改工作正常 但是当我使用这样的东西时: <h:form id="form"> <p:panel header="Panel" toggleable="true" closable="true" id="pan1"

我在WebSphereApplicationServer8上使用PrimeFaces3.2和ApacheMyFaces2

我有一个表单,您可以通过更改SelectOne按钮来选择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的值为空。 (setter方法中的记录器打印2倍的空值)


为什么该值为空?

每次出现这种行为时,都意味着没有正确指定某些更新。尝试整体使用update=“@form”。
为此使用SelectOneButton有点不常见,您也可以使用TabView来实现这一点。

这是一个PrimeFaces SelectOneButton错误。用PrimeFaces 3.4固定

问题跟踪程序中的问题3767链接:


这在PrimeFaces的3.4版中得到了修复。

您的
bean
的作用域是否至少有
ViewScope
或更多?我尝试过,但没有改变。不管渲染与否,它只有1列,所以我想我可以用selectOneButton来实现这一点