You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dave Newton <ne...@yahoo.com> on 2007/06/11 14:21:27 UTC

[OT] Re: How can i get servlet in my sessionDestroy() method?

--- Christopher Schultz wrote:
> Which servlet do you want access to?

I think he actually just wants the ServletContext so
he can remove the "userList" object:

Srinivasula Reddy A wrote:
> The listener class is extending Action as well as 
> implementing HttpSessionListener interface.
> Cant I have servlet in my sessionDestroy() method?

Now, I know what you're thinking: doesn't
sessionDestroy() have an HttpSessionEvent argument
containing both the session and its ServletContext?

You're probably also thinking: hmm, it's unusual that
it both extends Action and implements
HttpSessionListener. (Well, *I* think it's unusual,
anyway.)

d.



      ____________________________________________________________________________________
Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz

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


Re: [OT] Re: How can i get servlet in my sessionDestroy() method?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dave,

Wow, you have a gift for following multiple simultaneous threads ;)

Oh, yeah, and the whole thing is off-topic... this has nothing to do
with Struts (other than the fact that this listener extends action).

Dave Newton wrote:
> --- Christopher Schultz wrote:
>> Which servlet do you want access to?
> 
> I think he actually just wants the ServletContext so
> he can remove the "userList" object:
> 
> Srinivasula Reddy A wrote:
>> The listener class is extending Action as well as 
>> implementing HttpSessionListener interface.
>> Cant I have servlet in my sessionDestroy() method?
> 
> Now, I know what you're thinking: doesn't
> sessionDestroy() have an HttpSessionEvent argument
> containing both the session and its ServletContext?

I suppose if the listener extends Action, you can just call
this.getServlet()... but I'm pretty sure that makes no sense whatsoever.
Then again, neither does using an Action as a listener.

In fact, using an Action as a listener will result in two different
Action objects in memory... one that gets properly initialized and used
for handling requests, and one that is /not/ properly initialized and
gets used as the listener. My use of "this" above will fail miserably.

Yet another argument for doing things the way they were intended...

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGbT/l9CaO5/Lv0PARAr3wAJwOShnTWAhisdHhhLSHiJxq0UZo0gCfa6+J
x/82aRcmZo4D9UpSHTdUY4M=
=plRo
-----END PGP SIGNATURE-----

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