Best way to redirect to login page

Was wondering what the best way would be to redirect to the login page if a user tried to jump to one of my pages further along in the page navigation without first logging in (i.e. just typed the url in, or loaded a bookmark)?

With Spring I would simply setup an "Interceptor" which checked for the existence of a session object which was set by the login controller and it would redirect to the login page if that object doesn't exist.

Is there an easy way to do this in JSC+JSF? Currently I have to copy/paste code to my render methods on each page to do the check. The only way to avoid this would be to subclass AbstractPageBean and place the code in that subclass, but then I would have to remember to change my extends clause for every single page I add to a flow, which is no better really than having to add the 3 lines of code I need to each page.

Thanks,

Craig.

[904 byte] By [CraigTataryn] at [2007-11-26 9:16:06]
# 1

How about setting up a filter? Do you know about servelets? I am no expert myself, but I do know that you should be able to just add a filter...check the web.xml config panel I think...you're filter could act just like your Interceptor (they sound like the same thing, although I haven't used spring or done much servlet programming :) )

CandideEC at 2007-7-6 23:42:03 > top of Java-index,Development Tools,Java Tools...
# 2
I shall check that out, thank you.
CraigTataryn at 2007-7-6 23:42:03 > top of Java-index,Development Tools,Java Tools...
# 3
You might want to check out this post: http://forum.sun.com/jive/thread.jspa?forumID=123&threadID=50520I haven't tried it myself (it's still on the todo list), but siab provides step by step instructions for setting up a login check filter.
jsr at 2007-7-6 23:42:03 > top of Java-index,Development Tools,Java Tools...
# 4
You can use Spring within Creator. You may want to give that a try.
Tosa_Developer at 2007-7-6 23:42:03 > top of Java-index,Development Tools,Java Tools...
# 5
Here is a link to a page talking about integrating Spring and JSC. I have also used a ServletFilter for this and it seems to work fine: http://forum.sun.com/jive/thread.jspa?forumID=123&threadID=52657
darrinps at 2007-7-6 23:42:03 > top of Java-index,Development Tools,Java Tools...