• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validation Problem

 
omkar patkar
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Joan Horta Tosas
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you configured a MessageResources wich has this key inside "userDetailsForm.firstName", also as errors.required and other validation keys?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic