从 JSF 1.2 迁移到 JSF 2.0 后,每次导航时都会出现 ViewExpiredException
我正在尝试将现有的 JSF 应用程序从 JSF 1.2 迁移到 JSF 2.0。我正在使用 MyFaces 1.2.8,现在想使用 MyFaces 2.0.5。
我在使用 MyFaces 2.0.5 时遇到的情况是,最初请求的页面将正确呈现,但任何导航到其他页面的尝试都将导致 ViewExpiredException
。该消息是:
无法找到视图标识符的已保存视图状态:/SomePageName.jsf(其中“SomePageName”是我要离开的页面的名称)
如果我手动键入我想要导航到的页面的友好 URL,例如 http://localhost:8080/MYAPP/ SomeOtherPage.jsf ,那么另一个页面将被正确渲染。该应用程序还识别出我已经有一个会话,并且不会尝试创建新会话。
我的应用程序仅由 JSP 文件组成,正如您对 JSF 1.2 应用程序所期望的那样。我的目的是首先让应用程序在 JSF 2.0 中运行,然后一次将每个页面重写为 Facelet。
我的一些导航规则看起来像这样:
<navigation-rule>
<display-name>ManagePorts</displayName>
<from-view-id>/ManagePorts.jsp</from-view-id>
<navigation-case>
<from-outcome>REFRESH</from-outcome>
<to-view-id>/ManagePorts.jsp</to-view-id>
</navigation-case>
</navigation-rule>
有些看起来像这样:(
<navigation-rule>
<navigation-case>
<from-outcome>MANAGE_PORT_LIST</from-outcome>
<to-view-id>/ManagePorts.jsp</to-view-id>
</navigation-case>
</navigation-rule>
我意识到 REFRESH 结果不是最好的做事方式,但这已经在旧的 1.2 应用程序中,我不打算删除它,直到我开始迁移工作)
谁能告诉我我可能做错了什么,导致导航像这样崩溃?
I'm attempting to migrate an existing JSF application from JSF 1.2 to JSF 2.0. I was using MyFaces 1.2.8 and want to use MyFaces 2.0.5.
What I'm experiencing with MyFaces 2.0.5 is that the initially requested page will render properly, but any attempt to navigate to another page will result in a ViewExpiredException
. The message is:
No saved view state could be found for the view identifier: /SomePageName.jsf (where "SomePageName" is the name of the page that I am navigating away from)
If I manually type the Faces-friendly URL of the page I wanted to navigate to, such as http://localhost:8080/MYAPP/SomeOtherPage.jsf , then the other page will be properly rendered. The application also recognizes that I already have a session and does not try to create a new one.
My application consists exclusively of JSP files, as you would expect from a JSF 1.2 app. My intention is to first get the app working in JSF 2.0 and then rewrite each page as a Facelet one at a time.
Some of my navigation rules look like this:
<navigation-rule>
<display-name>ManagePorts</displayName>
<from-view-id>/ManagePorts.jsp</from-view-id>
<navigation-case>
<from-outcome>REFRESH</from-outcome>
<to-view-id>/ManagePorts.jsp</to-view-id>
</navigation-case>
</navigation-rule>
and some look like this:
<navigation-rule>
<navigation-case>
<from-outcome>MANAGE_PORT_LIST</from-outcome>
<to-view-id>/ManagePorts.jsp</to-view-id>
</navigation-case>
</navigation-rule>
(I realize that the REFRESH outcome is not the best way to do things, but that was already in the old 1.2 application and I'm not planning to remove it until I start the migration effort)
Can anyone tell me what I might be doing wrong that would cause the navigation to blow up like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我怀疑这是 MyFaces 特有的,我们从 Mojarra 1.2 迁移到 2.0 时没有遇到此问题。我建议您尝试一下,尽管这只是排除其中一个或另一个,以便您最终可以向 MyFaces 男孩报告该问题。
Tomahawk/Trinidad 没有明确要求 MyFaces 作为 JSF 实现。这是一个(营销)神话。它们恰好来自同一供应商(Apache)。第 3 方 JSF 组件库只需要 JSF API。 impl(Mojarra、MyFaces 等)确实不重要。
I suspect that this is MyFaces specific, we didn't have this problem when migrating from Mojarra 1.2 to 2.0. I would suggest to try it instead, even though it's only to exclude the one and other so that you can eventually report the issue to MyFaces boys.
Tomahawk/Trinidad doesn't explicitly require MyFaces as JSF impl. This is a (marketing) myth. They just happens to be from the same vendor (Apache). 3rd party JSF component libraries just require a JSF API. The impl (Mojarra, MyFaces, etc) really shouldn't matter.
此问题已修复:
https://issues.apache.org/jira/browse/MYFACES -3101
注意 MyFaces 2.0.7 和 2.1.1 已修复。
This issue was fixed on:
https://issues.apache.org/jira/browse/MYFACES-3101
Note MyFaces 2.0.7 and 2.1.1 has the fix.