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 1with 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]