For all of you who might care.

Here is the path I've taken.

Faces-config.xml...

<managed-bean>
        <description></description>
        <managed-bean-name>UserController</managed-bean-name>
        
<managed-bean-class>org.me.TaskListController</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>        
  </managed-bean>


JSP...

<h:outputText value="#{ UserController.user.firstName}" />


Java Code...

TaskListController.java

    public User getUser() {
        User user = new User();
        user.setFirstName("ERROR-LOAD FAILED");
        try {
            user =
UserManagementDelegate.getInstance().getCurrentUser();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return user;
    }

UserManagerEJBBean.java

/**
* @ejb.interface-method
*/    
public User getCurrentUser() throws Exception {
  String currentUserName =
sessionContext.getCallerPrincipal().getName();
  User user =
SpecialBackEndSystemToOldMainFrame.getUser(currentUserName);
  Return user;
}       

User.java

Simple bean holding firstName & surname.

Not sure if it's the best way. But it works.

Jeff.





-----Original Message-----
From: Volker Weber [mailto:[EMAIL PROTECTED] 
Sent: 20 October 2005 15:45
To: MyFaces Discussion
Subject: Re: User Management - advice needed.

You can do

FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal(
)

in every bean, also at first page.



Jeffrey Porter wrote:
> 
> 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.
> 
> 
> 
-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.

Reply via email to