File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes navigate from bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "navigate from bean" Watch "navigate from bean" New topic

navigate from bean

bostian tov
Ranch Hand

Joined: Mar 11, 2010
Posts: 32
I have method that checks if logged on user is admin or not. How can i make redirect in bean, when i know if user is not admin. I have made navigation rule, but dont know how to go further. Thanks
Bart Kummel
Ranch Hand

Joined: Nov 30, 2007
Posts: 81
Hi Bostian,

One of the most simple solutions is to have your action method return a String for the desired navigation case. For example, suppose you have the following button:

Then your managedBean should have a method like this:

You should have two navigation cases in your faces-config.xml: adminAction and normalUserAction. Each navigation case should lead to the desired page.

Good luck!

Best regards,
Bart Kummel

SCJP 1.4 | SCJD 1.6 | Visit my website | Author of the book Apache MyFaces 1.2 Web Application Development
I agree. Here's the link:
subject: navigate from bean
jQuery in Action, 3rd edition