----- Original Message ----- From: "Justy Wong" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, October 18, 2004 9:28 PM
Subject: Re: validation question
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.
Uhm ... don't think so. You could have a simple forward setup for the initial display of the form. Then, have your actual "meat and potatoes" action. That's two actions alright, but you only need to code one of them ...
Realize, when many say "an action", they mean an entry in the XML file. Sounds to me like you're thinking two seperate classes.
2) Turn validation off, and handle that in the action:
then I've to give up struts validation framework........
Yep. ... but you wouldn't have to have the extra action mapping.
I think these 2 suggestions are simple workaround for this problem, however,
it will break the framework in some degree....
Is there any other solutions come with Struts??
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! Justy
----- Original Message ----- From: "Durham David R Jr Contr 805 CSPTS/SCE" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, October 19, 2004 1:23 AM
Subject: RE: validation question
> The validation works fine however, when I just type the http://localhost:8080/login.do > in my browser (no submit), the validation error will show up at once. > I understand that it's just like I submit a form to login.do action without any > parameter. My question is, do struts provide any simple method to avoid this and just > show no error message?
There's a few different ways to handle this problem.
1) 2 action mappings -- 1 with validation turned off (welcome.do) and 1 with it on (login.do).
2) Turn validation off, and handle that in the action:
login.do
if (isSubmitted) { errors = form.validate() // redirect or do other authenticate work } else { return mapping.findForward("login"); }
HTH,
Dave
--------------------------------------------------------------------- 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]
--- avast! Antivirus: Outbound message clean. Virus Database (VPS): 0442-3, 10/15/2004 Tested on: 10/18/2004 9:49:09 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]

