It depends on the scope you really need. Application is like a safer
variant of static and thus is shared by all clients. If you work with
state on that level, consider thread safety. Session makes sense if
you have state that you want to have available throughout *your whole*
session, like the logged in user. For many cases however, you want to
share state between a couple of requests, but forget about it for the
rest of your application. Examples are wizards or master/ detail
screens. In that case, you want to pass the state around these
dependent pages/ components.
Eelco
On 2/9/06, Frank Silbermann <[EMAIL PROTECTED]> wrote:
>
>
>
> Others have asked about sharing information between pages, and the answer
> has been to pass the shared information via page constructors. Since no one
> suggested using the WebApplication object, does that imply that this is a
> singleton shared by all clients?
>
>
>
> It has been said that it is poor form to access the Session directly; one
> should pass page parameters instead. I imagine this is analogous to the
> programming language dictum of "loose coupling" – that one should use pass
> information in subroutine parameters rather than through shared global
> variables.
>
>
>
> However, if you have many pages, and a piece of the model is shared by _all_
> of them, would this be an exception to the rule? If so, what is the code
> for creating and accessing "global" session-scope objects?
>
>
>
> /Frank
>
>
>
>
>
>
N¬HY޵隊X¬²š'²ŠÞu¼’¦[§�‰ÜŒ¨º
Þ¦Øk¢è!–ˆŠW¬~Šé®†åzk¶ŠC£ [EMAIL PROTECTED],º·âža{›
å�,àHòÔ4¨m¶Ÿÿ±éZ²ëjY‚wþÇ¥rg