Thanks for all!! >From Joe: > > On the other hand, if you actually have this situation, you don't have to > > turn off validation -- simply implement your validation rules so that they > > can recognize the distinction. For example, have all your forms submit a > > hidden field, and have your validation method only evaluate its validation > > rules if that field has a defined value. When the page is retrieved > > without a form submission, this value is not going to be defined.
Joe, do u mean checking the field with "validwhen" using validation.xml or implement the actionForm.validate() ? I really want to use the basic struts validation framework instead of implementing validate() function to minimize the maintainence cost. >From Eddie: > Nope. Perhaps in time the Validation framework will evolve to be smart > enough that it "knows" (or can) that it doesn't need to validate the form on > the first display. I'm actually kind of surprised this behavior hasn't been > added in by now. Seems it would be simple enough to do, but, perhaps I'm > oversimplifying in my head. Thanks for your answer!! that means I've no other choices apart from changing my program.... ----- Original Message ----- From: "Eddie Bush" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, October 19, 2004 10:53 AM Subject: Re: validation question > Nice trick, Joe - hadn't thought of doing that :-) > > ----- Original Message ----- > From: "Joe Germuska" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Monday, October 18, 2004 9:40 PM > Subject: Re: validation question > > > > At 10:28 AM +0800 10/19/04, Justy Wong wrote: > >>Thx for your suggestions. > >> > >>> 1) 2 action mappings -- 1 with validation turned off (welcome.do) and 1 > >>with it on (login.do). > >> > >>that means for every action, I've to create 1 more action. but it will > >>almost double the maintainence affort. > > > > In practice, it's rare that you actually have a webapp where every single > > page is sometimes accessed as the result of a form submission and > > sometimes as a simple HTTP GET. And especially unlikely that you would > > have this to the scope where the actual dual maintenance is a serious > > burden. At least, in my experience, this is simply "the right way to do > > it." > > > > On the other hand, if you actually have this situation, you don't have to > > turn off validation -- simply implement your validation rules so that they > > can recognize the distinction. For example, have all your forms submit a > > hidden field, and have your validation method only evaluate its validation > > rules if that field has a defined value. When the page is retrieved > > without a form submission, this value is not going to be defined. > > > > Remember that you can implement the "validate()" method of your > > ActionForms anyway you like. > > > > Joe > > > > -- > > Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "In > > fact, when I die, if I don't hear 'A Love Supreme,' I'll turn back; I'll > > know I'm in the wrong place." > > - Carlos Santana > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --- > avast! Antivirus: Outbound message clean. > Virus Database (VPS): 0442-3, 10/15/2004 > Tested on: 10/18/2004 9:53:40 PM > avast! - copyright (c) 2000-2004 ALWIL Software. > http://www.avast.com > > > > > --------------------------------------------------------------------- > 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]