Re: Struts2 validation problem
newton.dave wrote: > > zud wrote: >> 1) Is old errors is not getting cleared that means when the filed value >> is >> empty when i submit the form it shows required that is ok and agian when >> i >> submit with empty values again now it shows messages like >> filed is required >> filed is required > > Are you using Spring as your object factory? If so, make sure the > actions are declared as being prototype scope. > > Dave > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > thanks for the reply i am not using springs i am using struts 2.x can you please help me out -- View this message in context: http://old.nabble.com/Struts2--validation-problem-tp28042625p28137191.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 validation problem
zud wrote: > > > > newton.dave wrote: >> >> zud wrote: >>> 1) Is old errors is not getting cleared that means when the filed value >>> is >>> empty when i submit the form it shows required that is ok and agian >>> when i >>> submit with empty values again now it shows messages like >>> filed is required >>> filed is required >> >> Are you using Spring as your object factory? If so, make sure the >> actions are declared as being prototype scope. >> >> Dave >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> >> > > -- View this message in context: http://old.nabble.com/Struts2--validation-problem-tp28042625p28137167.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 validation problem
zud wrote: > > > > newton.dave wrote: >> >> zud wrote: >>> 1) Is old errors is not getting cleared that means when the filed value >>> is >>> empty when i submit the form it shows required that is ok and agian >>> when i >>> submit with empty values again now it shows messages like >>> filed is required >>> filed is required >> >> Are you using Spring as your object factory? If so, make sure the >> actions are declared as being prototype scope. >> >> Dave >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> >> > > -- View this message in context: http://old.nabble.com/Struts2--validation-problem-tp28042625p28137165.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 validation problem
newton.dave wrote: > > zud wrote: >> 1) Is old errors is not getting cleared that means when the filed value >> is >> empty when i submit the form it shows required that is ok and agian when >> i >> submit with empty values again now it shows messages like >> filed is required >> filed is required > > Are you using Spring as your object factory? If so, make sure the > actions are declared as being prototype scope. > > Dave > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > -- View this message in context: http://old.nabble.com/Struts2--validation-problem-tp28042625p28137164.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 validation problem
zud wrote: 1) Is old errors is not getting cleared that means when the filed value is empty when i submit the form it shows required that is ok and agian when i submit with empty values again now it shows messages like filed is required filed is required Are you using Spring as your object factory? If so, make sure the actions are declared as being prototype scope. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 Validation Problem - validation errors not being cleared when corrected!
Hehe, I've just resolved my own issue! The problem was my spring configuration. I needed to specify scope="prototype" on each of my Struts 2 Action declarations. Singleton actions were being created and thus previous field errors were being carried over between requests. I'm surprised this isn't a more common gotcha that should be highlighted in the documentation. Rgds Murray 2009/10/23 Murray Furtado > Hi, > I'm using Struts 2.0.14 and validation annotations. I have a > UpdateUserAction class which implements ModelDriven and declares the > execute() method with the following : > > @Validations( visitorFields = { @VisitorFieldValidator(message="", > fieldName="model")} ) > > My model is a User class which has a number of @RequiredStringValidators, > etc. > > When I test the functionality I login to my app as a user with all it's > fields populated (ie a valid user). I then update a dropdown box in the > Update User jsp to the 'Select' value, to invalidate this property (declared > with a @RequiredStringValidator). Sure enough, when I submit the form, I > get a field error telling me this is a required field. So far so good. > > However when I then correct that field and resubmit, I still get the error! > I've added debug code to the prepare() method of the UpdateUserAction and > it shows that the previous field error is still present when I submit the > corrected form. This is strange because my understanding is that field > errors should get cleared between requests, and the validation framework > shouldn't fire until after the prepare() method has fired. So why am I > seeing validation errors in the prepare method? And why aren't they > clearing? > > What's even more frustrating is that I've downloaded the source code for > the xworks 2.0.7 package, and attached as source in Eclipse Galileo, but > then I can't set breakpoints in any of the xwork codebase to step through, > as each time I try and open an xwork java file, it takes me to the .class > file instead. > > Can anyone shed light on my problems as I can't see what I'm doing wrong? > > Thanks in advance, > > Murray > > >