struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jerry Jalenak" <Jerry.Jale...@LABONE.com>
Subject RE: [Validator HOW-TO] Invoking Validator validate method from Ov errd den validate method
Date Tue, 01 Oct 2002 17:08:31 GMT
OK, figured it out (if anyone is interested).  

After digging around in the DynaValidatorActionForm source a little, I tried
the following:

	public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request)
	{
		ServletContext context = getServlet().getServletContext();
		ActionErrors errors = new ActionErrors();
		
		String submitAction = (String) get("submitAction");
		if ((submitAction.equalsIgnoreCase("continue")) ||
(submitAction.equalsIgnoreCase("submit")))
		{
			Validator validator =
StrutsValidatorUtil.initValidator(mapping.getPath(), this, context, request,
errors, page);
			try
			{
				validatorResults = validator.validate();
			}
			catch(ValidatorException ve)
			{}
		}
		
		return errors;
	}

Figured if the default method could call Validator, so could I.  Works like
a charm.

Jerry

> -----Original Message-----
> From: Jerry Jalenak [mailto:Jerry.Jalenak@LABONE.com]
> Sent: Tuesday, October 01, 2002 11:18 AM
> To: 'struts-user@jakarta.apache.org'
> Subject: [Validator HOW-TO] Invoking Validator validate method from
> Overrd den validate method
> 
> 
> I have the following three buttons on a dataentry form:
> 
> 	<html:submit property="submitAction" value="Submit" />
> 	<html:submit property="submitAction" value="Reset" />
> 	<html:submit property="submitAction" value="Cancel" />
> 
> I'm using DynaValidatorActionForm to handle my form 
> validation.  The problem
> I have is that the validation is being performed regardless 
> of the button
> being clicked.  So I thought, just override the validate 
> method, check the
> button value, and if it is Submit, go ahead and let Validator 
> do its thing,
> otherwise don't.  The question I can't seem to answer is, how 
> do I do this?
> In other words, what do I pass back out of my validate method so that
> Validator either will (or will not) 'do its thing'?
> 
> TIA!
> 
> Jerry Jalenak
> Web Publishing
> LabOne, Inc.
> 10101 Renner Blvd.
> Lenexa, KS  66219
> (913) 577-1496
> jerry.jalenak@labone.com
> 
> 
> This transmission (and any information attached to it) may be 
> confidential and is intended solely for the use of the 
> individual or entity to which it is addressed. If you are not 
> the intended recipient or the person responsible for 
> delivering the transmission to the intended recipient, be 
> advised that you have received this transmission in error and 
> that any use, dissemination, forwarding, printing, or copying 
> of this information is strictly prohibited. If you have 
> received this transmission in error, please immediately 
> notify LabOne at (800)388-4675.
> 
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>


This transmission (and any information attached to it) may be confidential and is intended
solely for the use of the individual or entity to which it is addressed. If you are not the
intended recipient or the person responsible for delivering the transmission to the intended
recipient, be advised that you have received this transmission in error and that any use,
dissemination, forwarding, printing, or copying of this information is strictly prohibited.
If you have received this transmission in error, please immediately notify LabOne at (800)388-4675.



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


Mime
View raw message