struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Bathje" <...@ntsource.com>
Subject Re: session form "reset"
Date Thu, 22 Apr 2004 15:45:58 GMT
> >
> > Here is the chain of events, maybe that will help
> >
> > Form Preloader -> Form Page -> Submit Action -> Form
> > Preloader -> Form Page
> >
> > In Submit Action, I have tried doing
> > session.removeAttribute("myForm"); and
> > it doesn't work (gives the beanutils.populate error). I have
> >
>
> How about in your Submit action you fix your formbean, then do a
session.setAttribute(etc. ? Will that also give you a beanutil.populate
error? I wouldn't think so (but then again, as I said, I haven't worked with
session scoped forms..)
>

No, that doesn't work, when I say I looped through the form data to reset
it, I meant I did this:

DyanValidatorForm myForm = (DynaValidatorForm) form;
MyBean[] mybean = (MyBean[]) myForm.get("mybean");
for(int i=0; i<mybean.length; i++) {
    // do stuff I need to with mybean!
    mybean[i] = null;
    mybean[i] = new MyBean();
}

myForm.set("mybean", mybean);
request.setAttribute("mybean", mybean);
session.removeAttribute("myform");
session.setAttribute("myform", myForm);

I also tried in place of mybean[i] = null; mybean[i] = new MyBean();
mybean[i].property1=""; mybean[i].property2=""; mybean[i].property3="";,
etc.

While this doesn't error out on me, it just doesn't work - the form still
contains the previously submitted data. Seems very weird to me.

Matt Bathje


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message