On 4/1/07, davout <[EMAIL PROTECTED]> wrote:
I downloaded the r1.2.7 release and used this as my comparison basis. My IDE is 'MyEclipse' which uses a Struts 1.2 release. The xml files are exactly the same. I used the 'beyond compare' file comparison utility to view this, and there are no differences. . What next?
This error occurs when the configuration for a vaidation method doesn't match up with the actual method signature. So in your case the FieldChecks's validateRequired() method has a different method signature from what is configured in the methodParams element for the required validator in validator-rules.xml. As I said before, typically this occurs when people ugrade to a newer version of Struts and forget to upgrade the validation-rules.xml - but whatever the cause the solution is the same - ensure you have the correct validation-rules.xml for the version of Struts you're using. Saying "My IDE is 'MyEclipse' which uses a Struts 1.2 release." is vague - you need to determine which 1.2 version of Struts that is (There are four "GA" quality releases of Struts 1.2 - they are 1.2.4, 1.2.7, 1.2.8 and 1.2.9). The MANIFEST.MF file in the struts jar should tell you what version of struts you're using - when you find that out download that version of Struts and grab the validator-rules.xml from it. Niall
Niall Pemberton-2 wrote: > > Use the validation-rules.xml that comes with the version of Struts > you're using. This exception usually happens when people upgrade their > version of Struts but don't use the validation-rules.xml that ships > with the new version. > > Niall > > On 3/29/07, davout <[EMAIL PROTECTED]> wrote: >> >> I've added Struts validation to my application and I'm getting an >> exception >> when I try to use the 'required' validation type. >> >> Here's the code... >> >> The 'validation.xml' file... >> >> [Code] >> >> <?xml version="1.0" encoding="UTF-8"?> >> >> >> >> >> >> >> >> >> >> >> [/code] >> >> the start of the 'validation-rules.xml' file... >> >> [Code] >> >> >> >> >> >> >> [/code] >> >> the related action class... >> >> [Code] >> public class ImpactNegationEditAction extends >> AbstractImpactNegationAction >> implements EntityIDs, ImpactNegationIDs { >> >> public void save_onClick(FormActionContext aCtx) { >> ImpactNegationEditForm aForm = (ImpactNegationEditForm) >> aCtx.form(); >> aCtx.addErrors(aForm.validate(aCtx.mapping(),aCtx.request())); >> if (aCtx.hasErrors() == false) { >> // is add? >> if (aForm.getImpactNegationIDInt() == ID_UNASSIGNED) { >> // verify title is unique >> try { >> ImpactNegation anOther = >> getManager(aCtx).findByTitle(aForm.getTitle()); >> if (anOther != null) { >> >> addFieldError(aCtx,"title","error.duplicateField","Title"); >> } >> [/code] >> >> the related form... >> >> [Code] >> >> public abstract class AbstractSorForm extends FWValidatorForm { >> } >> >> public class ImpactNegationEditForm extends AbstractSorForm { >> >> private static final long serialVersionUID = 3604637580339030809L; >> >> private String fImpactNegationID; >> private String fTitle; >> private String fDesc; >> private String fDisplayOrder; >> private String fPercent; >> private String fCaptionDetail = null; >> private String fFormTitle = null; >> >> public ImpactNegationEditForm() { >> // TODO Auto-generated constructor stub >> } >> >> public String getDesc() { >> return fDesc; >> } >> >> public void setDesc(String aDesc) { >> fDesc = aDesc; >> } >> >> public String getDisplayOrder() { >> return fDisplayOrder; >> } >> public int getDisplayOrderInt() { >> return Integer.parseInt(fDisplayOrder); >> } >> >> public void setDisplayOrder(String aDisplayOrder) { >> fDisplayOrder = aDisplayOrder; >> } >> >> public String getImpactNegationID() { >> return fImpactNegationID; >> } >> >> public int getImpactNegationIDInt() { >> return Integer.parseInt(fImpactNegationID); >> } >> >> public void setImpactNegationID(String aId) { >> fImpactNegationID = aId; >> } >> >> public String getPercent() { >> return fPercent; >> } >> public double getPercentDouble() { >> return Double.parseDouble(fPercent); >> } >> >> public void setPercent(String aPercent) { >> fPercent = aPercent; >> } >> >> public String getTitle() { >> return fTitle; >> } >> >> public void setTitle(String aTitle) { >> fTitle = aTitle; >> } >> >> public String getCaptionDetail() { >> return fCaptionDetail; >> } >> >> public void setCaptionDetail(String aCaptionDetail) { >> fCaptionDetail = aCaptionDetail; >> } >> >> public String getFormTitle() { >> return fFormTitle; >> } >> >> public void setFormTitle(String aFormTitle) { >> fFormTitle = aFormTitle; >> } >> } >> [/code] >> >> the JSP body file... >> >> [Code] >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> [/code] >> >> the exception thrown... >> >> [Code:] >> >> the exception thrown when the form is validated... >> ERROR: 18:54:18: org.apache.struts.validator.ValidatorForm: >> org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, >> org.apache.commons.validator.ValidatorAction, >> org.apache.commons.validator.Field, >> org.apache.struts.action.ActionMessages, >> org.apache.commons.validator.Validator, >> javax.servlet.http.HttpServletRequest) >> org.apache.commons.validator.ValidatorException: >> org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, >> org.apache.commons.validator.ValidatorAction, >> org.apache.commons.validator.Field, >> org.apache.struts.action.ActionMessages, >> org.apache.commons.validator.Validator, >> javax.servlet.http.HttpServletRequest) >> at >> org.apache.commons.validator.ValidatorAction.loadValidationMethod(ValidatorAction.java:627) >> at >> org.apache.commons.validator.ValidatorAction.executeValidationMethod(ValidatorAction.java:557) >> at org.apache.commons.validator.Field.validateForRule(Field.java:811) >> at org.apache.commons.validator.Field.validate(Field.java:890) >> at org.apache.commons.validator.Form.validate(Form.java:174) >> at org.apache.commons.validator.Validator.validate(Validator.java:367) >> at >> org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:112) >> at >> com.eis.sor.struts.action.impactnegation.ImpactNegationEditAction.save_onClick(ImpactNegationEditAction.java:84) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >> at java.lang.reflect.Method.invoke(Method.java:585) >> at com.cc.framework.adapter.struts.ActionUtil.handleFormAction(Unknown >> Source) >> at com.cc.framework.adapter.struts.FWAction.handleFormAction(Unknown >> Source) >> at com.cc.framework.adapter.struts.ActionUtil.execute(Unknown Source) >> at com.cc.framework.adapter.struts.FWAction.execute(Unknown Source) >> at >> com.eis.sor.struts.action.common.AbstractSorAction.execute(AbstractSorAction.java:30) >> at com.cc.framework.adapter.struts.FWAction.execute(Unknown Source) >> at >> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421) >> at >> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226) >> at >> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164) >> at >> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) >> [/code] >> >> >> Any ideas??? >>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]