从JSF 1.2迁移到JSF 2.0后,每个导航上都有ViewExpiredException [英] ViewExpiredException on every navigation after migrating from JSF 1.2 to JSF 2.0
问题描述
我正在尝试将现有的JSF应用程序从JSF 1.2迁移到JSF 2.0。我正在使用MyFaces 1.2.8并且想要使用MyFaces 2.0.5。
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.
我在MyFaces 2.0.5中遇到的问题是最初请求的页面将正确呈现,但任何导航到另一个页面的尝试都将导致 ViewExpiredException
。消息是:
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:
找不到视图标识符的已保存视图状态:/SomePageName.jsf (其中SomePageName是名称我正在导航的页面)
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)
如果我手动输入我想要导航到的页面的Faces友好URL,例如 http:// localhost:8080 / MYAPP / SomeOtherPage.jsf ,然后将正确呈现其他页面。该应用程序还认识到我已经有一个会话,并且不会尝试创建一个新会话。
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.
我的应用程序完全由JSP文件组成,正如您对JSF所期望的那样1.2应用程序我的目的是首先让应用程序在JSF 2.0中运行,然后一次将每个页面重写为Facelet。
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>
,有些看起来像这样:
<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 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)
任何人都可以告诉我我可能做错了什么导致这样的导航爆炸?
推荐答案
我怀疑这是MyFaces的具体,我们没有从 Mojarra 1.2迁移到2.0时出现此问题。我建议尝试一下,即使它只是为了排除那个和其他,以便你最终可以向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.
我的想法已经不多了,所以尝试不同的JSF实现是唯一合乎逻辑的选择。我只是犹豫,因为我们正在迁移的应用程序中使用MyFaces Tomahawk和Trinidad附加组件。为了使用Mojarra(或其他东西)尝试应用程序,我将不得不删除依赖于附加组件的页面块。哦,好吧,我想我应该停止烦恼,就这样做吧! :)
Tomahawk / Trinidad没有明确要求MyFaces作为JSF impl。这是一个(营销)神话。他们恰好来自同一个供应商(Apache)。第三方JSF组件库只需要一个JSF API。 impl(Mojarra,MyFaces等)真的不重要。
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.
这篇关于从JSF 1.2迁移到JSF 2.0后,每个导航上都有ViewExpiredException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!