Geez, thanks Niall. I've been posting custom validation examples that wouldn't work with 1.2 and didn't realize it. Please let me know if there are any other significant validator plugin changes from 1.1 to 1.2.

Erik


Niall Pemberton wrote:

The validation method signatures in Struts 1.2 changed from ActionErrors to
ActionMessages, but it looks like you're trying to use a Struts 1.1 format
method with Struts 1.2.

Try changing your method signature to use ActionMessages.

Niall

----- Original Message ----- From: "Sivakumar Santharam" <[EMAIL PROTECTED]>
Sent: Thursday, March 03, 2005 10:45 PM





Error trace:
-----------
[3/3/05 14:21:48:926 EST] 7de0aacf ValidatorForm E
org.apache.struts.validator.ValidatorForm TRAS0014I: The following
exception was logged org.apache.commons.validator.ValidatorException:
gov.tva.wrkrcomp.util.Validator.validateInt(java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
javax.servlet.http.HttpServletRequest)
at org.apache.commons.validator.ValidatorAction.loadValidationMethod
(ValidatorAction.java:627)





Bill,
Thanks for your reply. I was trying to write a custome validation method


to


see whether it is working or not. I checked the method definition
(validateInt) and the declaration (int) in the validator-rules.xml and it
looks same.
Here is the sample code. I removed the generic validation methods to make


it


simple. Thanks Siva

------ validator class --
public static boolean validateInt(Object bean,ValidatorAction action,
Field field,ActionErrors errors,HttpServletRequest request) {
String value = ValidatorUtils.getValueAsString(bean,
field.getProperty());
boolean isFieldValid = false;
try {
Integer.parseInt(value);
isFieldValid = true;
} catch (Exception e) {
errors.add(field.getKey(), Resources.getActionError
(request, action, field));
isFieldValid = false;
}
return isFieldValid;
}





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to