IMHO, I would suggest storing objects for the shortest time possible. If an object is only going to be used once, there's no point clogging up memory with lots of unused objects, which won't be garbage collected until the session is destroyed.

My rule of thumb is to use the request when it's a one-off, the session if it might be used by another page, and the application if it will be used by more than one user (which is quite rare).

Digby


Adrian Beech wrote:
Hi all,

A work colleague mentioned on Friday it would be better to place objects
(beans and the like) which had been created in a servlet into the request
context when exposing them to the JSP.  To date all the code I've written
stores beans and the like in the session context and all has appeared to be
fine thus far.  I understand the nature of the various contexts and how they
relate to the process life cycle, etc.

Can someone please shed some light on this and possibly explain the merits
of placing the objects in either context?  For example, what are the
pitfalls of using the request context?  Is there any material around which
adequately details when or when not to use the specific contexts?

Cheers.
AB


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to