JSF 2 会话 Bean 问题
我有一个使用多个会话 Bean(所有 Bean 都是会话 Bean)运行的 JSF 2.1 (MyFaces) 应用程序。 超时在 web.xml 中定义如下:
<session-config>
<session-timeout>3600</session-timeout>
</session-config>
转换为 1 小时。
问题是,在正常使用时,我得到了 No Saved View...
异常:
SEVERE: An exception occurred
javax.faces.application.ViewExpiredException: /mainPanel.jsfNo saved view state could be found for the view identifier: /mainPanel.jsf
at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:128)
这些 beans 目前是在 faces-config.xml 中定义的,以便与 Eclipse 的 ide 兼容。
我不确定是什么原因造成的,而且绝对不是超时。 有什么想法可能是什么问题吗?
如果我可以提供任何进一步的信息,请告诉我..
谢谢!
PS - 没有 jsf-2.1
标签
更新 1 我只是认为 60 意味着 1 分钟! :-) 这可能是问题所在。如果结果是这样的话,我将关闭问题
更新 2 不是这样...更多一些信息可能会有所帮助:
- 虽然该错误是专门针对
/mainPanel.jsf< /code>,这实际上是使用
的 xhtml 组合, - 仅当我单击应用程序中的一个特定点时才会发生。单击结果运行的代码是:
Jquery
代码:
$(document).ready(function() {
$("#someTable tr:not(:first)").click(function(event) {
var someValue = $(this).find("input:hidden").val();
$('#currently_selected').val(someValue );
$('#currently_selected').change();
});
});
JSF 2
代码:
<h:form prependId="false" class="hide">
<h:inputText value="#{someBean.someBeanValue}">
<f:ajax event="change" listener="#{someBean.someBeanValueChanged}" render=":anotherForm"
onevent="ifCompleteSetWindowHash" />
</h:inputText>
</h:form>
I have a JSF 2.1 (MyFaces) app running using several Session Beans (All the beans are session beans).
The timeout is defined in web.xml as such:
<session-config>
<session-timeout>3600</session-timeout>
</session-config>
Which translates to 1 hour.
The problem is that on normal usage I get the No Saved View...
exception:
SEVERE: An exception occurred
javax.faces.application.ViewExpiredException: /mainPanel.jsfNo saved view state could be found for the view identifier: /mainPanel.jsf
at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:128)
The beans are, currently, defined in faces-config.xml for compatibility with Eclipse's ide.
I'm not sure what could be causing this and it's definitely not timeout.
Any ideas what could be the problem?
If there is any further information I can provide, let me know..
Thanks!
P.S - there is no jsf-2.1
tag
Update 1 I just figured 60 meant 1 minute! :-) That could be the problem. I will close the question if it turns out that way
Update 2 Thats wasn't it... Some more information That might be helpful:
- While the error is specifically for
/mainPanel.jsf
, this is actually a composition of xhtml's using<ui:include>
- It happends only when I click one specific point in the app. The code that runs as a result of the click is:
Jquery
Code:
$(document).ready(function() {
$("#someTable tr:not(:first)").click(function(event) {
var someValue = $(this).find("input:hidden").val();
$('#currently_selected').val(someValue );
$('#currently_selected').change();
});
});
JSF 2
Code:
<h:form prependId="false" class="hide">
<h:inputText value="#{someBean.someBeanValue}">
<f:ajax event="change" listener="#{someBean.someBeanValueChanged}" render=":anotherForm"
onevent="ifCompleteSetWindowHash" />
</h:inputText>
</h:form>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
乍一看,这似乎是 javax.faces.ViewState 隐藏字段的一些副作用。如果该字段被覆盖,则会抛出 ViewExpiredException。尝试对其他不同的 javascript 代码执行相同的操作。
无论如何,它与您的会话配置参数无关。此处提供的信息不足以重现它。如果前面的建议无法解决您的问题,请在 MyFaces 问题跟踪器 上创建问题,并附上一个例子。这样你就可以解决问题了。
At first view it seems to be some side effect over javax.faces.ViewState hidden field. If this field is ovewritten, a ViewExpiredException will be thrown. Try to do the same you are doing with other different javascript code.
Anyway it is not related to your session-config parameter. The information provided here is insuficient to reproduce it. If the previous suggestion does not solve your problem, please create an issue on MyFaces Issue Tracker and attach an example. In this way you'll get it solved.
我相信
$
符号是 JSF 中 EL 表达式的保留字符(编辑:如下所述,单独的“$”不是保留的,但是第三方组件库可能使用各种 JavaScript 库可能会与 jQuery 发生命名冲突)。 尝试将 jQuery 函数调用更改为显式长格式名称,看看是否会产生影响。例如。而不是...
这样做...
I believe the
$
symbol is a reserved character for EL expressions in JSF (EDIT: As noted below, the '$' alone is not reserved, however third party component libararies may use various javascript libraries that could have a naming conflict with jQuery). Try changing your jQuery function calls to the explicit long form name and see if that makes a difference.Eg. Instead of...
Do this...