Joshi,

Do you have a mapping from the form and the action that you are calling in
the Struts config?

Can I suggest that you take a look at the excellent sample chapter (12 is
the validation chapter) available at Manning books
http://www.manning.com/getpage.html?project=husted&filename=chapters.html.
This covers validation very well with lots of examples. Might want to also
try the Struts list.


Cheers

Mark

-----Original Message-----
From: Joshi, Sachin (MED) [mailto:[EMAIL PROTECTED]
Sent: Monday, 22 September 2003 3:25 p.m.
To: Jakarta Commons Users List
Subject: RE: Validator framework with Struts problem


Thanks for the quick response !! I have corrected the typo but still this is
not happening,
I have also tried explicitly calling validate method on
DynaValidatorActionForm in my Action class
but still does not seem to do anything, do you have any clue 



-----Original Message-----
From: Mark de Reeper [mailto:[EMAIL PROTECTED]
Sent: Monday, September 22, 2003 8:44 AM
To: 'Jakarta Commons Users List'
Subject: RE: Validator framework with Struts problem


Joshi,

Looks like a typo problem to me, one is defined as MyDynaForm and the
other
is MySDynaForm. 

Cheers

Mark

-----Original Message-----
From: Joshi, Sachin (MED) [mailto:[EMAIL PROTECTED]
Sent: Monday, 22 September 2003 2:44 p.m.
To: [EMAIL PROTECTED]
Subject: Validator framework with Struts problem


I am trying to use Jakarta commons validator framework with Struts in my
application but its not working for me 
can someone tell me how can it be done, I am trying to do validation for
a
required atttribute 
 
Here is my validation-rules.xml
 
<form-validation>
 <global>
  <validator
     name="required"
     classname="org.apache.struts.util.StrutsValidator"
     method="validateRequired"
     methodparams="java.lang.Object,
                   org.apache.commons.validator.ValidatorAction,
                   org.apache.commons.validator.Field,
                   org.apache.struts.action.ActionErrors,
                   javax.servlet.http.HttpServletRequest"
     msg="errors.required"/>
 
  <validator name="minlength"
     classname="org.apache.struts.util.StrutsValidator"
     method="validateMinLength"
     methodparams="java.lang.Object,
                   org.apache.commons.validator.ValidatorAction,
                   org.apache.commons.validator.Field,
                   org.apache.struts.action.ActionErrors,
                   javax.servlet.http.HttpServletRequest"
     depends="required"
     msg="errors.minlength"/>
 </global>
</form-validation> 
 
here is my validator.xml
 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<form-validation>
    <global>
        <constant>
            <constant-name>datePatternStrict</constant-name>
            <constant-value>MM/DD/yyyy</constant-value>
        </constant>
        <constant>
            <constant-name>timePatternStrict</constant-name>
            <constant-value>HH:MN</constant-value>
        </constant>
    </global>
    <formset>
        <form name="MyDynaForm">
            <field property="field" depends="required">
                <msg name="required" key="errors.required"/>
                <arg0 key="myfeature.field"/>
            </field>
        </form>
    </formset>
</form-validation>
Here is my DynaForm defication in struts-config.xml
 
<form-bean name="MySDynaForm"
type="org.apache.struts.validator.DynaValidatorActionForm">
    <form-property name="field" type="java.lang.String" />
    </form-bean>

 
Please let me know if there are some problems here 
Thanks & Regards,
Sachin
The information contained in this e-mail (and any accompanying
attachments)
is confidential and may be legally privileged. The information is
intended
only for the recipient(s) named in this message. Any reading, copying,
distribution or any other use of the information by the intended
recipient
other than the addressee/s is prohibited. If you have received this
message
in error, please delete the message and any attachments and notify
HealthPAC
immediately by email to [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
The information contained in this e-mail (and any accompanying attachments)
is confidential and may be legally privileged. The information is intended
only for the recipient(s) named in this message. Any reading, copying,
distribution or any other use of the information by the intended recipient
other than the addressee/s is prohibited. If you have received this message
in error, please delete the message and any attachments and notify HealthPAC
immediately by email to [EMAIL PROTECTED]

Reply via email to