u need to add <html:javascript > tag into ur form.
did u add this ????
On 5/30/06, M.Liang Liu <[EMAIL PROTECTED]> wrote:
I tried to use validator in my struts application and I find a problem
occurred:
The form did not validate itself and the execute method is
always called.
I active the plug-in in struts-config.xml as following:
> <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> <set-property
> property="pathnames"
> value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
> </plug-in>
>
and I write the validation.xml as following:
> <?xml version="1.0" encoding="iso-8859-1"?>
> <!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>
> <global>
> <constant>
> <constant-name>phone</constant-name>
> <constant-value>^\(?(\d{3})\)?[-| ]?(\d{3})[-|
> ]?(\d{4})$</constant-value>
> </constant>
> <constant>
> <constant-name>zip</constant-name>
> <constant-value>^\d{5}\d*$</constant-value>
> </constant>
> </global>
>
> <!-- ========================= Default Formset
> ========================= -->
> <formset>
> <form name="sForm">
> <field property="name" depends="required">
> <arg0 key="test.name"/>
> </field>
>
> </form>
> </formset>
> </form-validation>
>
>
I write the struts-config.xml as following for mapping
> <action
> attribute="sForm"
> input="/form/s.jsp"
> name="sForm"
> path="/s"
> scope="request"
> type="com.eam.struts.action.SAction"
> validate="true">
> <forward name="success" path="/welcome.do" />
> </action>
The form extends the ValidatorForm,
But it does NOT work.
Who can help me?
Thanks a lot.
--
Why Signature?
--
-------------------------------
Suresh babu S
Software Engineer
IBM,080-417 72568(Direct)
+91-9886237127
[EMAIL PROTECTED]