> -----Original Message-----
> From: Jim Douglas [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 15, 2004 12:30 PM
> To: [EMAIL PROTECTED]
> Subject: getAttribute syntax
> 
> 
> Can anyone tell me the best way to access the currently 
> loggoned on user 
> when needed in an application.
> 
> Is this the best way to go about it?

Well.. depends... what are you doing for authentication?  Container managed 
security?
Then no.  HttpServletRequest.getUserPrincipal
If you did it yourself... sure.
On the other hand... better is to simply create a BaseAction that has a method 
getUser( HttpRequest request) that returns your user object.  That way you can 
hide that implementation.

> 
>       HttpSession session = request.getSession()
>       String LogonName = session.getAttribute("userName");
> 
> Thanks,
> Jim
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to