commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Willingham" <comms...@maine.rr.com>
Subject RE: validator , basic dynabean, struts
Date Mon, 12 May 2003 13:46:10 GMT
Use "logonForm" in your

org.apache.struts.validator.Resources.initValidator("name",bean,
 
application,request,errors,page);

not "name"

it wants the form-bean name not fields.  Then the validator will apply
all edits to all fields based on the form

-----Original Message-----
From: Tridev Kodamasingh [mailto:Tridev.Kodamasingh@cramer.com] 
Sent: Monday, May 12, 2003 6:47 AM
To: 'commons-user@jakarta.apache.org'
Subject: validator , basic dynabean, struts

hi,

for the first time, I am looking at struts validator framework.
I am trying to make it work with struts with dynabean. I am having some
problem in making it work.
if somebody can give some insights to it, it would be very helpful.


1. I am populating a   basicdynabean in my  action class.
2. I am calling the validator framework's classes as below

	  Validator  validator =
org.apache.struts.validator.Resources.initValidator("name",bean,
 
application,request,errors,page);
	  ValidatorResults  validatorResults = validator.validate();


3. I want to validate different attribute properties of the dynabean.
	so, in the above code, "name" is the property which  I want to
validate.
	bean is the basicdynabean object which contains the  mapped
values.

4. in my validation.xml, the entries look like this

   <form-validation>
    <formset>
        <form name="logonForm">
            <field property="name"
                    depends="minlength"
                    bundle="alternate">
                <arg0   key="prompt.check1"/>
                <arg1   key="${var:minlength}" name="minlength"
                   resource="false"/>
                <var>
                    <var-name>minlength</var-name>
                    <var-value>10</var-value>
                </var>
            </field>
        </form>
    </formset>
   </form-validation>

5. in struts-config.xml, the corresponding entries look like this(but,
does
it matter anyway ?)

 <form-bean     name="logonForm"
 
type="org.apache.struts.validator.DynaValidatorActionForm">
      <form-property name="username1" type="java.lang.String"/>
      <form-property name="password1" type="java.lang.String"/>
      <form-property name="alias1" type="java.lang.String"/>
      <form-property name="arrayString" type="java.lang.String[]"
size="2"/>
	<form-property name="name" type="java.lang.String"/>
    </form-bean>

There must be something which I am missing out or doing something wrong.

Can anybody give some idea about  what is wrong going on here  ?

Thanks 

Tridev









---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org




Mime
View raw message