On 3/27/06, Michael Jouravlev <[EMAIL PROTECTED]> wrote:
> Session-scoped data allows you to navigate to any action keeping
> application state, so you don't need to obey an artificial page flow.
> I think this is a benefit usage-wise.
>
> I prefer to use session-scoped ActionForms and to put everything
> related to an object into the form as nested properties. This seems
> easier to handle for me.

As Michael says, there are significant benefits to using session
scope. In fact, the existance of session scope is one reason many
people chose Java in the first place. I still remember back in 2000
seeing many PHP frameworks struggling to create session scope that was
already built into Java.

Of course, you do need enough resources to support session scope for
all your users. And many of do have plenty of resources, so that is
not a problem. In fact, I know some very large business-to-consumer
sites that use session extensively, and successfully, to avoid
roundtrips to a database that might be on another continent.

The trick being that you need to load-test your application in your
environment to see if it meets your requirements :)

A useful technique, that came up on on aother thread recently, is to
create your own session object with the session, and store everything
you need there. This is what Michael is doing with ActionForms. In
"Programming Jakarta Struts", Chuck Cavenese implements a
"UserContainer" object to do the same sort of thing, and an
"ApplicationContainer" to manage whatever an application needs to
retain in global scope.

Sessions scope is a useful tool. The trick is not to scatter your
objects all around (like we do with the Action API), but to keep
everything in one place.

HTH, Ted.

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

Reply via email to