Jsf错误:java.lang.ClassCastException [英] Jsf Error : java.lang.ClassCastException
问题描述
我正在使用glassfish 3.0.1上的jsf 2.0来构建我的搜索引擎的界面,当我在我的jsf页面上使用Openfaces组件时,每当我提交表单时,我都会收到以下错误消息:
i am using jsf 2.0 on glassfish 3.0.1 to build an interface to my search engine , when i used Openfaces components on my jsf page and whenever i submit a form i get this error message :
java.lang.ClassCastException:[Ljava.lang.Object;无法投射到
com.sun.faces.application.view.StateHolderSaver
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.sun.faces.application.view.StateHolderSaver
我没有在网上找到任何帮助,请问有什么问题?以及如何摆脱它?
i didnt find any help on the web , please what is the problem ? and how to get rid of it ?
谢谢。
推荐答案
这被称为 JSF issue 1427 。在JSF POST导航案例打开的页面上触发ajax请求时,部分状态保存可能会失败。建议的顺序有三种解决方案:
This is known as JSF issue 1427. Partial state saving may fail when ajax requests are fired on a page which is been opened by a JSF POST navigation case. There are three solutions, in recommended order:
-
不要使用POST进行页面到页面的导航。因此,请按
< h:link>
或<替换
。另请参见< h:commandLink>
H:outputLink的>h:outputLink
vsh:commandLink
。
Do not use POST for page-to-page navigation. So replace
<h:commandLink>
by<h:link>
or<h:outputLink>
. See alsoh:outputLink
vsh:commandLink
.
实施POST-Redirect-GET模式。因此,如果您仍在 faces-config.xml
中使用旧式< navigation-case>
,则添加< redirect />
条目。或者,如果您使用隐式导航结果,则将?faces-redirect = true
查询字符串添加到结果中。
Implement POST-Redirect-GET pattern. So if you're still using old fashioned <navigation-case>
in faces-config.xml
, then add <redirect/>
entry. Or if you're using implicit navigation outcomes, then add ?faces-redirect=true
query string to the outcome.
配置有问题的页面以利用完全状态保存。
Configure the problematic pages to utilize full state saving.
<context-param>
<param-name>javax.faces.FULL_STATE_SAVING_VIEW_IDS</param-name>
<param-value>/pagename.xhtml</param-value>
</context-param>
(可以使用逗号作为分隔符定义多个页面)
这篇关于Jsf错误:java.lang.ClassCastException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!