On 3/22/06, Mark Lowe <[EMAIL PROTECTED]> wrote: > On 3/22/06, Michael Jouravlev <[EMAIL PROTECTED]> wrote: > > On 3/22/06, Mark Lowe <[EMAIL PROTECTED]> wrote: > > > For data you need to store across lots of requests, you can create a > > > simple javaclass to hold the data you need. Something like a StateBean > > > or even a hashmap, the point is that if you have one object that your > > > storing things in you know where to look if and when you find you need > > > to address session size. If you have folk adding the world into the > > > session all over the place, its going to be harder to address any > > > issues later in the day. e.g. Map state = (Map) > > > session.getAttribute("state") > > > > Such holder class is already provided by Struts for every action. It > > is called ActionForm ;) I stick all my action-related... I mean, > > webresource-related :) stuff into corresponding ActionForm. > > If its the from you want in the session, you wont hear any arguements > from me there. But its also possible that the data you need to store > isn't really a form, you may need to populate a form with some session > scoped data (yes it could well be an action form). You may want to > reset a form but not the session scoped gubbins. One example i can > think of is maintaining the state of a gui, selected items and such > like. I never have a real need to have this data mapped to an action.
This data is not mapped to an action, it belongs to a web resource. An action (or several actions) handle requests to a web resource, while ActionForm holds state of a web resorce. Instead of fixating on actions try to concentrate on an ActionForm ;) If Struts had Action and ActionForm as one class, things would be easier. I don't care that ActionForm was originally intended to hold request values. I use it as a web resource state holder and stick all kind of resource-related stuff into it. Works great for me, all in one place, accessible. I can also make use of Struts automatic population of nested properties. Michael. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]