change your strut config to use org.apache.struts.validator.DynaValidatorForm
-Dan ----- Original Message ----- From: "Thomas Miskiewicz" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Sunday, June 15, 2003 9:42 AM Subject: Validator Framework Questions > Hello! > > Reading a Struts book I wanted to give the validator framework > a whirl. Since it's poorly described in the book I checked out > Struts website. I wonder if when we speak about automatic form > validation, then if do we mean the validator from the website > http://home.earthlink.net/~dwinterfeldt or has another > validator been integrated into Struts. How doI setup an > automatic form validation? > > I've build a form with 3 fields called field1, field2, field3 > and a submit button. I've defined the validation rules in the > validation.xml file, but this thing just doesn't work. Below > my setup. > > my validation.xml looks like this: > > <form-validation> > <formset> > <form name="postTestForm"> > <field property="field1" > depends="required,maxlength"> > <msg name="required" > key="error.posttest.field.null"/> > <msg name="maxlength" > key="error.posttest.field.length"/> > <arg0 key="myapp.posttest.form.titlelabel"/> > <arg1 name="maxlength" key="${var:maxlength}" > resource="false"/> > <var> > <var-name>maxlength</var-name> > <var-value>5</var-value> > </var> > </field> > <field property="field2" > depends="required,maxlength"> > <msg name="required" > key="error.posttest.field.null"/> > <msg name="maxlength" > key="error.posttest.field.length"/> > <arg0 key="myapp.posttest.form.introlabel"/> > <arg1 name="maxlength" key="${var:maxlength}" > resource="false"/> > <var> > <var-name>maxlength</var-name> > <var-value>2048</var-value> > </var> > </field> > <field property="field3" > depends="required,maxlength"> > <msg name="required" > key="error.posttest.field.null"/> > <msg name="maxlength" > key="error.posttest.field.length"/> > <arg0 key="myapp.posttest.form.bodylabel"/> > <arg1 name="maxlength" key="${var:maxlength}" > resource="false"/> > <var> > <var-name>maxlength</var-name> > <var-value>100000</var-value> > </var> > </field> > </form> > </formset> > </form-validation> > > my struts-config.xml lookis like this: > > <?xml version="1.0" encoding="ISO-8859-1"?> > <!DOCTYPE struts-config PUBLIC "-//Apache Software > Foundation//DTD Struts Configuration 1.1//EN" > > "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"> > > <struts-config> > > <form-beans> > > <form-bean name="postTestForm" > type="org.apache.struts.validator.DynaActionForm"> > <form-property name="field1" type="java.lang.String" > initial=""/> > <form-property name="field2" type="java.lang.String" > initial=""/> > <form-property name="field3" type="java.lang.String" > initial=""/> > </form-bean> > > </form-beans> > > <global-forwards> > <forward name="system.error" > path="/WEB-INF/jsp/systemError.jsp"/> > <forward name="default.action" > path="/execute/homePageSetuo"/> > </global-forwards> > > <action-mappings> > > <action path="/homePageSetup" > type="com.mycompany.HomePageSetupAction" > unknown="true"> > <forward name="homepage.success" > path="/WEB-INF/jsp/homePage.jsp"/> > </action> > > <action path="/postTestSetup" > type="com.mycompany.PostTestSetupAction" > name="postTestForm" > scope="request" > validate="false"> > <forward name="posttest.success" > path="/WEB-INF/jsp/postTest.jsp" /> > > </action> > > <action path="/postTest" > input="/WEB-INF/jsp/postTest.jsp" > type="com.mycompany.PostTest" > name="postTestForm" > scope="request" > validate="true"> > <forward name="posttest.success" > path="/execute/homePageSetup"/> > </action> > > </action-mappings> > > <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> > > Thanks in advance for you help! > > Tom > > > --------------------------------------------------------------------- > 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]