struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Heligon Sandra <sandra.heli...@nextream.fr>
Subject Struts Validator problem error with default values
Date Wed, 16 Oct 2002 16:09:34 GMT

	I use Struts Validator in my application and I have the following
error
	on my JSP login page:

	cannot be less than 3 characters. Password cannot be less than 3
characters. UsernamePassword

	Username:
	Password:
	<button: Login>
	

	This error has to be displayed if a user select the login button
without
	enter a loginName or password.
	But not the first time that the page is displayed.
	Is it due to the forward ?

	My configuration is the following Struts1.1b2 with Tiles and
Validator:
	
	struts_config.xml:
	<form-beans>
	  <form-bean name="LoginForm" dynamic="true"
type="org.apache.struts.validator.DynaValidatorForm">
	    <form-property name="userName" type="java.lang.String"
initial="" />
	    <form-property name="password" type="java.lang.String"
initial="" />
	  </form-bean>
	</form-beans>

	<global-forwards>
	    <forward name="welcome" path="/welcome.do" />
	    <forward name="login" path="/login.do" />
	</global-forwards>

            <action path="/welcome"
            	type="org.apache.struts.tiles.actions.NoOpAction">
	            <forward name="success" path="site.login.page"/>
	</action>

	<action path="/login"
            	name="LoginForm"
	            validate="true"
            	type="com.compagny.LoginAction"
	            input="site.login.page"
            	scope="request">
	            <forward name="success" path="callsStatus.do" />
	</action>

	validation.xml:
	<form name="LoginForm">

            <field property="userName"
                    depends="minlength,maxlength">
                <arg0   key="label.username"/>
                <arg1   key="${var:minlength}" name="minlength"
                   resource="false"/>
                <arg2   key="${var:maxlength}" name="maxlength"
                   resource="false"/>
                <var>
                    <var-name>maxlength</var-name>
                    <var-value>16</var-value>
                </var>
                <var>
                    <var-name>minlength</var-name>
                    <var-value>3</var-value>
                </var>
            </field>

            <field property="password"
                    depends="minlength,maxlength">
                <arg0   key="label.password"/>
                <arg1   key="${var:minlength}" name="minlength"
                   resource="false"/>
                <arg2   key="${var:maxlength}" name="maxlength"
                   resource="false"/>
                <var>
                    <var-name>maxlength</var-name>
                    <var-value>16</var-value>
                </var>
                <var>
                    <var-name>minlength</var-name>
                    <var-value>3</var-value>
                </var>
            </field>

	</form>

	Thanks in advance,
	

	

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message