This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes Diiference between the Validator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Diiference between the Validator" Watch "Diiference between the Validator" New topic
Author

Diiference between the Validator

rex tony
Ranch Hand

Joined: Aug 29, 2007
Posts: 159
I think this is the basic difference between DynaValidatorActionForm and DynaValidatorForm,Is there any other differences?Give an elaborate note

DynaValidatorActionForm
struts-config.xml ,action mapping -> path <-> validation.xml,name

DynaValidatorForm
struts-config.xml ,action mapping -> name <-> validation.xml,name
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The difference between DynaValidatorActionForm and DynaValidatorForm is the same as the difference between ValidatorActionForm and ValidatorForm. The usage of each is explained in the Struts Validator Guide

Once you have configured the Validator Plug-In, so that it can load your Validator Resources you just have to extend org.apache.struts.validator.action.ValidatorForm instead of org.apache.struts.action.ActionForm . Then when the validate method is called, the action's name attribute from the Struts Configuration is used to load the validations for the current form. The form element's name attribute in the Validator configuration should match the action element's name attribute.

An alternative approach is to use the action mapping path attribute. In this case, you extend the ValidatorActionForm instead of the ValidatorForm. The ValidatorActionForm uses the action element's path attribute from the Struts configuration which should match the form element's name attribute in the Validator configuration.

Then a separate action mapping can be defined for each page in a multi-page form, and the validation form can be associated with the action rather than a page number (as shown in the example of a multi-page form in the validator example).


Merrill
Consultant, Sima Solutions
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Diiference between the Validator