For ValidatorForm it uses the "attribute" value for the key to the validation - in your case thats "LogonForm" - but your validation.xml uses the form "name" of "logonForm". So either change the key in the validation.xml or the attribute on your action mapping.
You don't actually have to specify "attribute" on an action mapping - if you don't (which I never do) it uses the form name. So unlesss you have a specific need for it probably the easiest solution is to remove the "attribute" attribute altogether. If the above doesn't solve your problem then the first step in these kind of problems is to configure the logging to "debug" for Struts and Commons Validator - that should give you more information about what Struts is trying to do and maybe give you a clue where things are going wrong. Niall On 4/18/07, Kirthi <[EMAIL PROTECTED]> wrote:
I am using Struts Validator Frame work to do both Client and Serverside Validation. I am using Struts 1.2 My Validator is not triggring at all. I am trying to figure out the mistake from the last two days, but no luck. I am extending the ValidatorForm Class. Can anyone help me with this one. thanks Here is the code. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"> <struts-config> <data-sources /> <form-beans> <form-bean name="logonForm" type="com.yourcompany.struts.LogonForm"/> </form-beans> <global-exceptions /> <global-forwards /> <action-mappings> <action attribute="LogonForm" input="/MyJsp.jsp" name="logonForm" path="/Logon" scope="request" validate="true" type="com.yourcompany.struts.Logon"> <forward name="success" path="/MyJspSuccess.jsp" /> <forward name="failure" path="/MyHtml.html" /> </action> </action-mappings> <message-resources parameter="com.yourcompany.struts.ApplicationResources" /> <!-- Validator Configuration --> <plug-in className="org.apache.struts.validator.ValidatorPlugIn"> <set-property property="pathnames" value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml"/> </plug-in> </struts-config> ************************************************************************* <!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN" "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd"> <form-validation> <formset> <form name="logonForm"> <field property="username" depends="required"> <arg0 key="prompt.username"/> </field> </form> </formset> </form-validation> ************************************************************** package com.yourcompany.struts; import org.apache.struts.validator.ValidatorForm; public class LogonForm extends ValidatorForm { private String username; private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } ********************************************************** http://www.nabble.com/file/7961/struts-config.xml struts-config.xml http://www.nabble.com/file/7962/validation.xml validation.xml http://www.nabble.com/file/7963/validator-rules.xml validator-rules.xml -- View this message in context: http://www.nabble.com/Validatoin-not-working-tf3603238.html#a10066448 Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- 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]