This is a very appropriate use for interceptors. You might also want to look at Spring Security, which does this and a lot more without too much configuration pain.
jk On Sat, Jun 27, 2009 at 12:25 PM, Robin Mannering <ro...@mtndesigns.co.uk>wrote: > Hello, > > Struts 2.1.6 > > I wish to ensure a user is logged into an application before allowing > him/her to execute certain tasks. > > Would using an Interceptor be a good way to go? > > My idea is to retrieve session data in the intercept() method of the > interceptor and verify a certain attribute is held in the session. > > If it is not, I would then like to redirect the user to a login page with > an appropriate error message. > > Is this an approriate use of interceptors? Previously, I simply had a > verifyLoginStatus() method in a base action class which I extended in > actions I wanted to protect. > > I'd appreciate any thoughts... > Thanks > Robin > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com