wood burning stoves 2.0*
The moose likes Struts and the fly likes Validation Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Validation Problem" Watch "Validation Problem" New topic
Author

Validation Problem

omkar patkar
Ranch Hand

Joined: Aug 25, 2005
Posts: 231
Hi guys,

I am working on struts 1.2.8 and Apache Tomcat 4.1. I came across problem while using the validation framework of struts. Following is the exception that is thrown. I cannot make out from this stack trace where i am possibly going wrong ....the error message is incompletly displayed on the screen along with success message. :-







My JSP looks something like this :-










The configuration that i have made in my struts-config.xml is :-










My validation.xml looks something like this :-










Now ...my action class looks something like this :-





The problem is besides displaying the incomplete error message, the details from the form are submitted till the database layer. I am frustated, somebody please help me point out the problem.

Million thanks
mkar Patkar


Thanks and Regards
Omkar Patkar (SCJP 1.4)[url]http://javacollectionsnotes.blogspot.com[/url] | [url]http://omkar-myscjpexp.blogspot.com[/url]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
When you use the Struts Validation Framework, each action must have an input attribute so the framework knows which page to return to if there's an error. I suspect the error you're getting is because you haven't defined an input attribute for the action in the struts-config.xml file. Example:

[ March 07, 2007: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Joan Horta Tosas
Ranch Hand

Joined: Feb 01, 2007
Posts: 59
Does your com.dynamo.presentation.form.UserForm class extend ValidatorForm or any of its subclasses? Maybe that's your problem... As well as what Merrill Higginson said.
omkar patkar
Ranch Hand

Joined: Aug 25, 2005
Posts: 231
Hi Merill and Joan,

Yes , i have extended my form bean from ValidatorForm class. Also i have included the changes ( input attribut ) as you had told for the action tag in the struts-config.xml....BUT I still get the error ! .... i don't
know how i can solve this problem! ... from the stack trace i don't even get to know which parameter is giving the problem. ... any more ideas ?

Please ???

Thanks Regards
mkar Patkar
Joan Horta Tosas
Ranch Hand

Joined: Feb 01, 2007
Posts: 59
Have you configured a MessageResources wich has this key inside "userDetailsForm.firstName", also as errors.required and other validation keys?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Did you remember to restart the server after making the changes? It sounds silly, but you'd be surprised how many people forget to do that.

Also, check the integrity of your installation. Make sure that all jar files come from the same Struts download, and that you're not mixing and matching.
Dileep Kamath
Greenhorn

Joined: Jul 15, 2006
Posts: 19
Please check the signature of the FieldChecks.validateRequired method mentioned in your validator-rules.xml against the actual signature of the method in your struts jar.
omkar patkar
Ranch Hand

Joined: Aug 25, 2005
Posts: 231
Yes ! ... the key is present in the Resource propertie file ... i mean other labels on the page are displayed using the keys from the jsp page. i had also restarted the server ....but i think i will have to check the second last and last option of jar files that Merill and Dileep have mentioned.


Thanks and regards
mkar Patkar
omkar patkar
Ranch Hand

Joined: Aug 25, 2005
Posts: 231
Hi Merill and Dileep,

Thank you guys ...the problem was because of version mismatch, i was using the validator-xml of struts 1.2.7 and struts.jar of version 1.2.8 .....Due to version mismatch there was difference in the method signature of validateRequired()

.........AND







...phew ! ....finally the problem is solved. Thanks a lot guys !

mkar Patkar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Validation Problem
 
Similar Threads
Prepoulating form fields
server side validation errors
headache with validation framework
Confused on validate() method
DynaValidatorForm and Struts validator - not working at all...