File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes getCallerPrincipal in Managed Bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "getCallerPrincipal in Managed Bean" Watch "getCallerPrincipal in Managed Bean" New topic

getCallerPrincipal in Managed Bean

Pasquale Imbemba

Joined: Feb 08, 2012
Posts: 5


in EJB I can use getCallerPrincipal() from javax.ejb.SessionContext; I wonder how to get this information when I just use JSF, i.e. from within a Managed Bean only?

I appreciate any help.


Pasquale Imbemba

Joined: Feb 08, 2012
Posts: 5

This will do the trick:

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

I usually put this kind of code in a special "JSFUtils" class in order to keep the bulk of the code framework-independent. But yes, that's the function you need.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: getCallerPrincipal in Managed Bean
It's not a secret anymore!