I've messed about and got my action method to make a call to a
SessionBean. 
Which then looks up the current user via the SessionContext.
The bean I create is then passed into the page via a t:saveState tag.

This is great for all pages off the main page, since an action method
has been called before. Which located the user & populated the bean.

For the first page though doesn't get displayed via an action method.
So I'm stuck. 

I'm now looking into the Session-listener. Get back to you all with what
I find.

Any advice would be great though.




-----Original Message-----
From: Jesse Alexander (KBSA 21)
[mailto:[EMAIL PROTECTED] 
Sent: 20 October 2005 15:04
To: MyFaces Discussion
Subject: RE: User Management - advice needed.

Add a user-info-bean when
a) the session is created (Session-listener)
b) the user-credentials are created (by JAAS?)
and just display them from within the JSF-page...

hth
Alexander 

________________________________

From: Jeffrey Porter [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 20, 2005 2:39 PM
To: MyFaces Discussion
Subject: User Management - advice needed.



 

Hello again.

 

My question is this.

 

I want when a JSF page is displayed, to look up the current user and
display some information on them.

For example...

 

<%

Principal principal = request.getUserPrincipal();

      String userName = principal.getName();

      User user = SomeUserManagementServerThing.loadUser(userName);

%>

 

<%=userName%>

<%=user.isAdmin()%>

 

The above code is fine for the old JSP/Struts way of doing thing. But
what is the approach I should take in MyFaces?

 

If the action method that makes the call to display the page knew about
the Principle I could pass the User object in and all would be great.

But I don't see a way for an action method to find out the currently
logged in user.

 

What do you guys think? Is a there a paper / tutorial already on this
that I've missed?

 

Thanks

Jeff

 

Using: JBoss 4.02, JAAS, DatabaseAuthentication

Reply via email to