javax.faces.ViewState is missing after ajax render

蓝咒 提交于 2019-12-10 15:32:39

问题


This is not a duplicate post, i just done research but not helping.

First, this is my page... simplified for easy reading.

            <h:form id="treeForm">
                <f:event type="preRenderView" listener="#{taskTreeBean.update}" />              
                <rich:tree id="tree" nodeType="#{node.type}" var="node"
                    value="#{taskTreeBean.rootNodes}" toggleType="client"
                    selectionType="ajax"
                    render="@all"
                    selectionChangeListener="#{taskTreeBean.selectionChanged}">
                    <rich:treeNode>
                    ...
                    </rich:treeNode>
                </rich:tree>
            </h:form>
            <h:form id="taskListTableForm">
                <rich:dataTable id="taskListTable" styleClass="tasklist" keepSaved="true" value="#{taskListModel}" var="task"
                    rowClasses="odd-row, even-row" rows="3">
                    <rich:column>
                    ...
                    </rich:column>
                    <f:facet name="footer">
                        <rich:dataScroller id="scroller" for="taskListTable" />
                    </f:facet>
                </rich:dataTable>
            </h:form>

When i click some tree node, task list form will render, but the viewstate will disappear, which makes dataScroller requires two clicks to next/prev page since the first click is getting back the ViewState value.

I checked the JIRA here - http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-790.

Tried render="@all" or render="treeForm, taskListTableForm", both failed. I cannot wait mojarra to release 2.2. So is there any workaround here?

Thanks so much. The JIRA is just too difficult to understand.

Edited: There is another problem, the page go from 1 to 2 in the dataTable if i click the tree node. Why?


回答1:


I am aware that you probably solved this problem, but for future reference, this should provide others with the solution.




回答2:


I had the same problem and worked around it by replacing <f:ajax/> with <p:ajax/> from PrimeFaces 3.0. The page in question has no other PrimeFaces components. I don't know why it works, but hopefully it will in your case.



来源:https://stackoverflow.com/questions/7830795/javax-faces-viewstate-is-missing-after-ajax-render

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!