本文介绍了Ajax渲染后javax.faces.ViewState丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这不是重复的帖子,我只是做过研究但没有帮助.

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>

当我单击某个树节点时,将呈现任务列表表单,但视图状态将消失,这使得dataScroller需要单击两次到下一页/上一页,因为第一次单击是返回ViewState值

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.

我在这里检查了JIRA- http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC- 790 .

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

尝试render ="@ all"或render ="treeForm,taskListTableForm"均失败.我等不及mojarra发布2.2版.那这里有什么解决方法吗?

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

非常感谢. JIRA太难理解了.

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

已编辑:还有另一个问题,如果我单击树节点,则页面在dataTable中从1转到2.为什么?

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

推荐答案

我知道您可能已经解决了此问题,但是为了将来参考,应为其他人提供解决方案.

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

这篇关于Ajax渲染后javax.faces.ViewState丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 09:57