commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark de Reeper <Mark.deRee...@hpac.govt.nz>
Subject RE: Validator framework with Struts problem
Date Mon, 22 Sep 2003 03:14:08 GMT
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:Sachin.Joshi@geind.ge.com]
Sent: Monday, 22 September 2003 2:44 p.m.
To: commons-user@jakarta.apache.org
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 helpdesk@hpac.govt.nz

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message