I'm using the JSF 1.2 + Seam 2.2.1 and JBossAS 4.0.4.
我正在使用JSF 1.2 + Seam 2.2.1和JBossAS 4.0.4。
I have the following entry in the file pages.xml:
我在文件pages.xml中有以下条目:
<exception>
<end-conversation/>
<redirect view-id="/facelets/error.xhtml"/>
</exception>
But if I click on a commandLink and a commandButton after the session has expired, the server throws the following exception:
但是,如果在会话过期后单击commandLink和commandButton,服务器将抛出以下异常:
12:19:09,671 WARN [lifecycle] executePhase(RESTORE_VIEW 1,com.sun.faces.context.FacesContextImpl@1d7187f) threw exception
javax.faces.application.ViewExpiredException: viewId:/facelets/login.xhtml - View /facelets/login.xhtml could not be restored.
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:187)
It may also be worth noting, that no response get returned whatsoever.
值得注意的是,没有回复任何回复。
I have already tried to catch the catch the exception explicitly, but it does not work.
我已经尝试明确捕获异常捕获,但它不起作用。
Any suggestions?
3 个解决方案
#1
0
I found this while searching for error handling with Seam a while back
我在搜索Seam的错误处理时发现了这一点
<\!-\- Now we specify the super class of all Exceptions: java.lang.Exception. This will catch all exceptions. \-->
<\!-\- But it will give us access to the Exception to retrieve its contents for display to the screen. \-->
<exception class="java.lang.Exception">
<\!-\- still a good idea to end the "conversation" rather than leaving it open ended. \-->
<end-conversation/>
<\!-\- now we redirect to the current page. The code for this is in the next example. \-->
<redirect view-id="#{viewId.currentValue}">
<\!-\- specify the message severity as error. Also the expression language used below allows us to "grab"-->
<\!-\- the exception that was captured above and then pass it to the h:message tag for display to the end \-->
<\!-\- user. Much nicer than a debug screen. \-->
<message severity="error">
#{org.jboss.seam.handledException.message}
</message>
</redirect>
</exception>
With this you should actually be able to catch everything and expose it for what it is. the viewId.currentValue
thing is a piece of code we used to write to the current page, but you could redirect to wherever you wanted.
有了这个,你实际上应该能够抓住所有东西并将它暴露出来。 viewId.currentValue是我们用来写入当前页面的一段代码,但你可以重定向到你想要的任何地方。
#2
0
I found this link on Seam's community site where they are discussing a similar problem. Perhaps your answer is there? They cover a couple of different solutions, depending on where the problem stems from.
我在Seam的社区网站上找到了这个链接,他们正在讨论类似的问题。也许你的答案在那里?它们涵盖了几种不同的解决方案,具体取决于问题源自何处。
#3
0
Try using the following in pages.xml:
尝试在pages.xml中使用以下内容:
<exception class="javax.faces.application.ViewExpiredException">
<redirect view-id="/pages/login.xhtml">
<message severity="error">Your session has timed out, please Log-In again</message>
</redirect>
</exception>
#1
0
I found this while searching for error handling with Seam a while back
我在搜索Seam的错误处理时发现了这一点
<\!-\- Now we specify the super class of all Exceptions: java.lang.Exception. This will catch all exceptions. \-->
<\!-\- But it will give us access to the Exception to retrieve its contents for display to the screen. \-->
<exception class="java.lang.Exception">
<\!-\- still a good idea to end the "conversation" rather than leaving it open ended. \-->
<end-conversation/>
<\!-\- now we redirect to the current page. The code for this is in the next example. \-->
<redirect view-id="#{viewId.currentValue}">
<\!-\- specify the message severity as error. Also the expression language used below allows us to "grab"-->
<\!-\- the exception that was captured above and then pass it to the h:message tag for display to the end \-->
<\!-\- user. Much nicer than a debug screen. \-->
<message severity="error">
#{org.jboss.seam.handledException.message}
</message>
</redirect>
</exception>
With this you should actually be able to catch everything and expose it for what it is. the viewId.currentValue
thing is a piece of code we used to write to the current page, but you could redirect to wherever you wanted.
有了这个,你实际上应该能够抓住所有东西并将它暴露出来。 viewId.currentValue是我们用来写入当前页面的一段代码,但你可以重定向到你想要的任何地方。
#2
0
I found this link on Seam's community site where they are discussing a similar problem. Perhaps your answer is there? They cover a couple of different solutions, depending on where the problem stems from.
我在Seam的社区网站上找到了这个链接,他们正在讨论类似的问题。也许你的答案在那里?它们涵盖了几种不同的解决方案,具体取决于问题源自何处。
#3
0
Try using the following in pages.xml:
尝试在pages.xml中使用以下内容:
<exception class="javax.faces.application.ViewExpiredException">
<redirect view-id="/pages/login.xhtml">
<message severity="error">Your session has timed out, please Log-In again</message>
</redirect>
</exception>