Java Virtal Machine.net

[ News ] rss

February 01, 2011

Mark Wielaard: New GPG key. Finally created a new GPG key using gnupg. The old one was a DSA/1024 bits one and 8 years old. The new one is a RSA/2048 bits one. I will use the new one in the future to sign any release tarballs I might create. pub 2048R/57816A6A 2011-01-29 Key f...

More »

February 01, 2011

Andrew Hughes: [SECURITY] IcedTea6 1.7.8, 1.8.5, 1.9.5 Released!. We are pleased to announce a new set of security releases, IcedTea6 1.7.8, IcedTea6 1.8.5 and IcedTea6 1.9.5. This update contains the following security updates: The IcedTea project provides a harness to build the source code from OpenJDK6 u...

More »

March/2024
SunMonTueWedThuFriSat
     12
3456789
10111213141516
17181920212223
2425262728 2930
31      

[ Archives News
for 'Java Technology' ]

home > news > java technology > dealing gracefully with viewexpiredexception in jsf2

Dealing Gracefully with ViewExpiredException in JSF2

My previous entry dove under the covers for JSF 2.0 and examined composite component metadata. This one is far less esoteric and shows how to handle the ViewExpiredException using a new JSF feature, the ExceptionHandler, contributed by Pete Muir a JSF Expert Group representative from JBoss. JSF throws a ViewExpiredException when a postback is made to a view and, for whatever reason, that view cannot be restored. Usually this is due to a session timeout, but a custom state management solution could also cause this exception to be thrown. The default behavior in JSF2 is to show the Facelets error page saying View Expired. The default page is illustrated at right. One way to fix this is to declare an element in your web.xml, as shown here.             javax.faces.application.ViewExpiredException         /faces/viewExpired.xhtml       This works well enough. You can even put JSF components on the error page if you put the proper Faces Servlet mapping in the element, as shown above. If you want to do some application level manipulation in response to the exception, you'll want something different, however. In this case, a custom ExceptionHandler is just the trick. I cover this in much more detial in my upcoming book, JavaServer Faces 2.0: The Complete Reference, and the example shown in this blog entry is neatly integrated into the chapter 10 sample...


Date: September, 03 2009
Url: http://www.java.net/blog/edburns/archive/2009/09/03/dealing-gracefully-viewexpiredexception-jsf2


Others News

©2002-2019Java-Virtual-Machine.net web editor | free web editor | Bootstrap Templates | easy free website builder | top web builder