Best practice question

I'm working on an application that has a main page where the user must log in and after this, gains access to other pages within the application. This all works okay.

However, if the user does not log in (bypasses the main page) by entering the full url in the address bar or by using a saved favourite, I would like this trapped and the user be automatically sent to the main page.

I would like to do this either in the constructor (could be bypassed by loading the page twice) or in each of the getXXX properties.

Can I initiate a navigation event from either of these locations?

Is there a better way to handle this?

[652 byte] By [reichewa] at [2007-10-2 13:11:44]
# 1

there is kind of 2 schools of though on this

but the best way to do this sort of login is either a phase listener or view handler

i use a custom vew handler extends ViewHandler

then just in the createView() overwrite this

if there user is not logged in ( i.e have a user bean or connection bean to show user is loged in)

if bean is not present create the view for your main page and return that otherwise create the noraml view

there are a few posts on this topic

http://forum.java.sun.com/thread.jspa?forumID=427&threadID=502322

dboyd68a at 2007-7-13 10:40:07 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...