Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

navigate from bean

 
bostian tov
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic