> -----Original Message----- > From: Jim Douglas [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 15, 2004 2:38 PM > To: [EMAIL PROTECTED] > Subject: RE: getAttribute syntax > > > > This worked, > > String userName = ((LogonForm) form).getUsername(); > > > How would you do it container managed? That sound > like the next > best way. (BaseAction being the best.)
HttpServletRequest.getRemoteUser() iirc. > > Jim > > > >From: "Jim Barrows" <[EMAIL PROTECTED]> > >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >Subject: RE: getAttribute syntax > >Date: Wed, 15 Dec 2004 12:48:50 -0700 > > > > > > > > > -----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] > > > > > > --------------------------------------------------------------------- > 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]