aspose file tools*
The moose likes Struts and the fly likes Validation issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Validation issue" Watch "Validation issue" New topic
Author

Validation issue

Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52
I am calling a logon form as shown below in the struts config file...



Since I have given validate="true", the page load with errors (empty/null errors for required check). I would like to load the form first, ie w/o checking the errors. And want to validate on submit of the form rather than on load.

Could anyone pl point out where is the mistake I am making...?

[ June 14, 2007: Message edited by: Bhaskar Reddy ]
[ June 14, 2007: Message edited by: Bhaskar Reddy ]
Zip Ped
Ranch Hand

Joined: Jul 26, 2005
Posts: 336
Override the validate method in your Form bean and check for first time and second time requests by passing some parameter.

You can return null from you validate method on first time entry.
Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52
Thank you for the reply!

I am extending the ValidatorForm and using the struts built-in validations. I want to avoid writing the validation logic in the ActionForm.

Is there any other workaround for this?
Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52
I have now tried using validator method check for a hidden field (firstTimeFlg) value in the logonForm as follows :

But this field is not recognized in the Form's validate method...

Could someone pls tell me why is the hidden field in a form not recognized in the Form's validate method?
Zip Ped
Ranch Hand

Joined: Jul 26, 2005
Posts: 336
Could you post the code for your LoginForm?

Also, did you try to retrieve the value of the hidden field through the request parameter?
Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

post the code. I believe validate refers to inputs and no hidden


===Vyas Sanzgiri===
My Blog
Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52
Hi Kailash,

I could resolve the issue... I think I was not getting it from the request object!!!

below code works!



Thank you for your valuable input.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Validation issue