I think that is good. This along the lines of what I was thinking. David
--- William W <[EMAIL PROTECTED]> wrote: > > My solution : > > I did a class MyValidator with two methods > (verifyMethod and > validateRequired) > > ------- > private static boolean verifyMethod( > Object bean, > ValidatorAction va, > Field field, > ActionErrors errors, > HttpServletRequest request) { > > String methodRequest = > request.getParameter("method"); > String methodsToValidate = > field.getVarValue("method"); > > boolean validate = false; > > if ((methodsToValidate != null) && > (methodsToValidate.length() > 0)) { > if (methodRequest != null) { > if (methodsToValidate != null) { > StringTokenizer st = new > StringTokenizer(methodsToValidate, > ","); > String method = " "; > while (st.hasMoreElements()) { > method = (String) > st.nextToken(); > if > (method.equals(methodRequest)) { > validate = true; > break; > } > } > } > > } > } > > return validate; > } > > public static boolean validateRequired( > Object bean, > ValidatorAction va, > Field field, > ActionErrors errors, > HttpServletRequest request) { > > if (verifyMethod(bean,va,field,errors,request)) > return > StrutsValidator.validateRequired(bean,va,field,errors,request); > else > return false; > } > ---------- > In the file validaion-rules.xml I changed the > validator required like this: > <validator name="required" > classname="MyValidator" > method="validateRequired" > ........... > </validator> > > Now , I can configure in the validator.xml the > methods that I want to > validate. For example : > > <form name="logonForm"> > <field property="userId" > depends="required"> > <arg0 > key="logonForm.email.displayname"/> > <var> > <var-name>method</var-name> > > <var-value>update,delete</var-value> > </var> > </field> > </form> > David, What do you think about this solution ? > > Thanks, > William. > > > _________________________________________________________________ > MSN Photos is the easiest way to share and print > your photos: > http://photos.msn.com/support/worldwide.aspx > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > __________________________________________________ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>