struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Weber, Jeremy" <JWe...@Eventra.com>
Subject Simple Custom Validation Example Request
Date Wed, 18 Dec 2002 14:36:33 GMT
Could someone post the very simplest example of some custom validation code.
I am still having problems with my code as explained in previous post below.
Maybe if I start of smaller I could make some sense of whats going on. 



Thanks,


Jeremy


Im trying to start of simple with a custom validaton method.  Currently all
it contains is a system.out to verify that the method never gets called. Can
some one verify that my configuration is correct?  I would appreciate it.


validator-rules.xml

      <validator name="identical"
		 classname="com.vs.install.util.VsValidate"
		 method="validateIdentical"
		 methodParams="java.lang.Object,
		       org.apache.commons.validator.ValidatorAction,
		       org.apache.commons.validator.Field,
		       org.apache.struts.action.ActionErrors,
		       javax.servlet.http.HttpServletRequest"

		 depends="required"
		 msg="errors.identical"
	/>


validation.xml
	<form    name="SetupFormBean">
			<field    property="vsynchNum"
				depends="required,integer">
				<arg0
key="newinstall.vsynchnum.displayname"/>
			</field>
			<field    property="vsappNum"
				depends="required,integer,identical">
				<arg0
key="newinstall.vsappnum.displayname"/>
			</field>
			<field    property="installDir"
				  depends="required">
				  <arg0
key="newinstall.installdir.displayname"/>

			</field>
		</form>

package com.vs.util.validate;

import java.io.Serializable;
import java.util.Locale;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.commons.validator.Field;
import org.apache.commons.validator.GenericValidator;
import org.apache.commons.validator.ValidatorAction;
import org.apache.commons.validator.ValidatorUtil;
import org.apache.struts.util.StrutsValidatorUtil;
import java.text.*;
import java.util.*;

public final class VsValidate implements Serializable  {

	public VsValidate() {
	}


	public static boolean validateIdentical(Object bean, ValidatorAction
va, Field field, ActionErrors errors, HttpServletRequest request){
	       System.out.println("entered method");

		return true;
	}



}




--
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