struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Barrows" <jbarr...@sssc.com>
Subject RE: getAttribute syntax
Date Wed, 15 Dec 2004 19:48:50 GMT


> -----Original Message-----
> From: Jim Douglas [mailto:jdz99@hotmail.com]
> Sent: Wednesday, December 15, 2004 12:30 PM
> To: user@struts.apache.org
> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message