I'm using form beans in session memory too, mainly because I want to refer to their contents in other pages further down the line, not just the next one.
If you put a form bean into session memory, then it will stay there. If you call MyFormBean mfb = (MyFormBean) form You have a pointer to the Form Bean that is still in session memory. So any changes made to mfb (like calling set methods on it) will automatically be reflected in the version in session memory, as you are changing the same instance. Tim. -----Original Message----- From: Dariusz Wojtas [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 19, 2002 4:26 PM To: Struts Users Mailing List Subject: RE: Form beans in session scope I set such properties in my action classes too. And it is enough. I don't set that bean to it's scope again. And everything works perfectly. That's probably because the bean is referenced all the time from the action class and from the session object. Hope I am not wrong. Darek At 16:03 2002-03-19 +0000, you wrote: >If you're manually calling your formbean's "setter" methods then you'll need >to then re-add the formbean to the session (or request or whatever scope you >are using). I don't know what you're trying to do, but I've never manually >called any such setter methods. They're usually called automatically when >you submit a form to an Action class (i.e. the action-mapping element of >struts-config tells Struts which formbean to populate for the specified >action and what scope to give it). > >I'd stick with request scope for formbeans, but it does not sound like you >are using them in the conventional way - so maybe some more detail on what >you're trying to do would help. > >Lindsay > > -----Original Message----- >From: Kevin J. Turner [mailto:[EMAIL PROTECTED]] >Sent: 19 March 2002 15:26 >To: Struts Users Mailing List >Subject: Form beans in session scope > >I have configured my struts-config file to keep my form bean in >session scope. I don't know if this is good practice, but I wasn't >having much luck with the request scope. > >In many of my action classes, if have to get a reference to my form >bean to do some business logic processing. I do so by doing the >following: > > MyFormBean mfb = (MyFormBean) form > >Then I call some methods.... > > mfb.setAlpha("beta"); > mfb.setGamma("delta"); > etc.. > >At this point do I need to explicitly re-add/reset the form bean by >doing something like this: > > session.setAttribute(mapping.getAttribute(), mfb); > >Or does calling the methods automatically update the form bean thats >in the session? > ><k> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

