Now this is a Java question, if "XXX newForm = (XXX) form" resulted in form and newForm having the same memory space? How do I really make a duplicate copy with different memory space (beside using new, or is new the only solution)?
Sebastian Ho On Wed, 2004-10-27 at 17:44, dmu2201 wrote: > Sebastian Ho wrote: > > >Hi > > > >Can someone point out why this do not work, or why this work? > > > >What this does, get a Actionform, set a value in it, add the ActionForm > >into an Vector, set the Vector into Session. > > > >Strangely the new ActionForm is not displayed in the JSP returned by > >ActionForward. It only appears if the ActionForm reset is not called > >before returning the method. > > > >How can the reset method affect my codes? > > > >and yes, the values was printed out before returning and all the values > >are there.. > > > >Why is that so? > > > >Thanks > > > >Sebastian Ho > > > >--------------------------------------------------------- > > > > > > > <snip> > > >//RESET FORM > >//form.reset(mapping, request); > > > > > > > Since all Java calls with objects in them are call-by-reference you are > actualling calling reset on the object you've just added to your Vector. > I don't know how your reset method is implemented of course, but I would > presume that all the values are reset to default values when you call > reset. > > If you want to preseve the values you've would have to make a copy of > the form object and then add the copy to the vector... > > Don't know if this is what you meant, but this is how I understand it :-) > > Enjoy... > Claus > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]