Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JSF and the fly likes JSF Suggestions Needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF Suggestions Needed" Watch "JSF Suggestions Needed" New topic
Author

JSF Suggestions Needed

Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
I am developing a JSF application where by the navigation is from PageA-->PageB-->PageC . At page A The user signs in. The problem is if a user decides to access Page B with out signing in I want the application to authomatically redirect to PageA so that this user can sign in .
Any Suggestions would be welcome
Dudley Dawson
Ranch Hand

Joined: Dec 14, 2004
Posts: 57
A filter should do the trick.
Google "Intercepting Filter Pattern"
James McCluskey
Greenhorn

Joined: Aug 23, 2007
Posts: 10
Can you not just use standard servlet security for this?

[ August 26, 2007: Message edited by: James McCluskey ]
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
Hi,

Check for a specific token in the session, if that token is not there, do the redirection, otherwise, do your normal work.

Get a reference to the current instance of the FacesContext, which you use to get an instance of the ExternalContext, which has a method named getSession() that references to the HttpSession object.

Let me know what happens with you ...

Best of luck ...


Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
And one more thing, the ExternalContext contains a method named getResponse(), which actually is the HttpServletResponse, so you can use its sendRedirect() method to do the redirection.

Whenever the user logs in, use the HttpSession object to add an attribute in the session.

Best of luck ...
Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
Originally posted by Vassili Vladimir:
Hi,

Check for a specific token in the session, if that token is not there, do the redirection, otherwise, do your normal work.

Get a reference to the current instance of the FacesContext, which you use to get an instance of the ExternalContext, which has a method named getSession() that references to the HttpSession object.

Let me know what happens with you ...

Best of luck ...


The idea Sounds interesting,I would try this and let you know

Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JSF Suggestions Needed
 
Similar Threads
question regarding hidden fields
https back to http
Refresh the previous page
Problem in setting view root in beforeRenderResponse()
How to go back to a page