struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chaudhary, Harsh" <HCHAU...@amfam.com>
Subject RE: ValidatorActionForm vs ValidatorForm
Date Thu, 25 May 2006 18:42:22 GMT
Use ValidatorActionForm when you want to key the validation by the
Actions i.e. certain fields will be validated if a certain action is
called. Suppose you have a big Struts Form which serves as the form for
a number of actions e.g. updateClient.do, deleteClient.do,
loginClient.do etc.

Suppose your struts form is MyForm.java

You want only certain fields to be validated on a call to a particular
action. Use ValidatorActionForm. Your entry would look like this in
validation.xml:

<form name="/updateClient">
	  
	  <field property="fieldA" depends="required,integer,intRange">
			bla...bla...
  	  </field>
</form>

<form name="/deleteClient">
	  
	  <field property="fieldB" depends="required,integer,intRange">
			bla...bla...
  	  </field>
</form>

Whereas if you use ValidatorForm, the entire form would be validated as
your entry in validation.xml would look like:

<form name="MyForm">
	  <field property="fieldA" depends="required,integer,intRange">
			bla...bla...
  	  </field>
	  <field property="fieldB" depends="required,integer,intRange">
			bla...bla...
  	  </field>
</form>

Hope that clears things up a bit.

Harsh.

-----Original Message-----
From: pantichd [mailto:pantichd@firstenergycorp.com] 
Sent: Thursday, May 25, 2006 1:35 PM
To: user@struts.apache.org
Subject: ValidatorActionForm vs ValidatorForm



Hello,

I'm struggling to understand the difference between the
ValidatorActionForm
and the ValidatorForm. 

The main difference I find in API is that the key passed into the
ValidatorForm "is the action element's 'name' attribute from the
struts-config.xml" and the key passed into the ValidatorActionForm "is
the
action element's 'path' attribute from the struts-config.xml"

I understand that part but not the significance. 
  
In what situation(s) would I choose one over the other? 

Thanks in advance for any responses. Sorry for being dense.  : )

David.
--
View this message in context:
http://www.nabble.com/ValidatorActionForm+vs+ValidatorForm-t1682623.html
#a4563821
Sent from the Struts - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message