How to Prevent Navigating Away From a Page?

Hi all,

I抦 developing a JSF application using IBM Rational Application Developer v6.0 and have this scenario:

Background:

I have a page that acts as a 3 step wizard. It also contains links to other pages. The page has a corresponding 損agecode?bean with a request scope and another managed bean with a session scope and basically everything happens here, all the action and action listeners. Also this managed bean handles three important events the 損age load? 損age load ends? and 損age post?

Desired Behavior:

I want to enforce the user to complete all three steps of the wizard without navigating away from this wizard like page by displaying a message 揾ey you must complete all three steps?or something like that :).

Problem:

The user can click on other links on the page and navigate away from the wizard without completing all three steps.

Any suggestions to this issue would be of great help.

Thanks in advance.

[977 byte] By [JSFera] at [2007-10-3 0:36:08]
# 1

My suggestion is to put h:inputHidden fields that points to #{sessionScope.completedNumber} and to incremet it in the three pages. Override the default navigation handler and in it check the completedNumber and if it isn't null or >2 then add error message and redisplay the page. Here is a tutorial how to override the default navigation handler. http://www.jsftutorials.net/jsfNavigation/jsf-login-navigation-redirect.html

amitteva at 2007-7-14 17:29:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

First: how do I change my stupid screen name? :)

Thanks for your solution. Would this also work for normal html navigation? My understanding that this may only work for the JSF framework navigation rules. On the other hand I also have plain html links on the page and not really sure if the JSF framework also handles these types of navigation.

This maybe a partial solution though and I really appreciate this.

Thanks.

geeeeeeea at 2007-7-14 17:29:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
If you want to make the validation outside the jsf navigation facility you should use ServletFilter. The scenario could be similar with this i suggested above.
amitteva at 2007-7-14 17:29:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...