Just to throw in anothe opion :) I agree with you.
As I understand you want to exchange object between two requests of the same session. If you have information that has a scope that is below a session, I don't see any reason to store it with a scope that is above the session (application or context). I don't see any benefit at all but several disadvantages. If you store the information in the session you have following advantages: - If you have errors in your applications that sometimes forget to remove object, you can at least be shure that they will be removed at the end of the session. (Of course you can implement your own code in a Listener that destroys the data from the context or application, but why implement something that is done by the container anyway) - If you have to scale your site up to use a loadbalancer with distributed session, this will work only if all informations that belong to a session are store in the session (Or you have to write code that serializes the data that you store The only reason to store this data in a scope that is above the session level, is to store it in a database instead of the memory (e.g. to implement your own distributed/failsafe sessions). Of course it's good practice to reduce the objects in the session but not at the price to store them just in different scope in memory. What you can do, is reuse objects between sessions if the object are the same or to use references. E.g. if you have an application that implements a shopping cart you just need the references to the products that are in the basket not the products itself. In your case I would recommend to store the data in the session and to remove them on your own as soon as possible. One additional advice: give the objects names by using a naming convention that makes it unlikely that you add, change or remove them by accident. Ralph Einfeldt Uptime Internet Solution Center GmbH Hamburg, Germany Hosting, Content Management, Java Consulting http://www.uptime-isc.de > -----Urspr�ngliche Nachricht----- > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Gesendet: Donnerstag, 1. August 2002 22:33 > An: Tomcat Users List > Betreff: Re: howto avoid overuse of session object? > > Thanks, C�dric and Peter Lin, for your responses. Both of > you seem to be saying that, instead of storing large objects > in the session object, -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
