struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <lau...@holoweb.net>
Subject Re: validation framework problem?
Date Tue, 05 Sep 2006 16:17:18 GMT
Everything looks OK so far, based on a quick scan through. What does the 
rest of your login.jsp look like? In particular, what does your 
html:form tag look like and where is the html:javascript tag?

You specified staticJavascript="false", so where are you importing the 
static Javascript from? If you tell the tag not to generate it, you'll 
need to have something else do so.

L.

Mallik wrote:
> Hi friends
> --------------------------------------
> this is my Action Login.java
> package com.pack1;
> 
> import org.apache.struts.action.*;
> import javax.servlet.http.*;
> 
> public class Login extends Action
> {
> 	public ActionForward execute(ActionMapping mapping, ActionForm form,
> HttpServletRequest request, HttpServletResponse response) throws Exception
> 	{
> 		return mapping.findForward("find");
> 	}
> }
> 
> -------------------------------------
> this is my total struts-config.xml
> 
> <!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>
> 	<!-- =========DynaActionForm Bean -->
> 		<form-bean name="LoginForm"
> type="org.apache.struts.validator.DynaValidatorForm">
> 			<form-property name="userId" type="java.lang.String"/>
> 			<form-property name="password" type="java.lang.String"/>
> 		</form-bean>
> 	</form-beans>
> 	
> 	<action-mappings>
> 		<action path="/index" forward="/pages/index.jsp"/>
> 		
> 		<action path="/login"   type="com.artifacts.Login" 
> input="/pages/index.jsp" >
> 			<forward name="find" path="/pages/login.jsp"/>
> 		</action>
> 		
> 		<action path="/loginVerify" name="LoginForm" scope="request"
> validate="true" type="com.artifacts.LoginVerify" input="/pages/login.jsp">
> 			<forward name="valid" path="/pages/welcome.jsp"/>
> 			<forward name="invalid" path="/pages/login.jsp"/>
> 		</action>
> 		
> 		<action path="/logout" forward="/pages/logout.jsp"/>
> 		
> 		<action path="/collegeSetup"  type="com.artifacts.CollegeSetup">
> 			<forward name="completed" path="/pages/viewCollege.jsp"/>
> 			<forward name="notCompleted" path="/pages/setupCollege.jsp"/>
> 		</action>
> 		
> 	</action-mappings>
> 	
> <!--application resources file-->	
> 	<message-resources parameter="timeTableMessages"/>
> 	
> <!-- ==========Data Source========== -->
> 	<data-sources>
> 		<data-source>
> 			<set-property property="driverName"
> value="oracle.jdbc.driver.OracleDriver"/>
> 			<set-property property="url"
> value="jdbc:oracle:thin:@172.23.162.200:arti"/>
> 			<set-property property="user" value="aims"/>
> 			<set-property property="password" value="aims"/>
> 			
> 		</data-source>
> 	</data-sources>
> 
> <!-- =========validator plugin=========== -->
> 	<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>
> 
> -------------------------------------------
> i hope this will help u in better 
> waiting for solutions and thanks inadvance
> Mallik
> 
> 
> Mallik wrote:
>> HI Friends
>> i am using validation framework with struts at fontend
>> but the validation is not working properly
>> first-time validation is taking place at server side ( displaying errors
>> on window)
>> second-time onwards it is taking place at client side (getting alert)
>> why these all?
>> this is my code:
>> ------------------------------------------------------
>> struts-config.xml
>>
>> <form-bean name="LoginForm"
>> type="org.apache.struts.validator.DynaValidatorForm">
>> 	<form-property name="userId" type="java.lang.String"/>
>> 	<form-property name="password" type="java.lang.String"/>
>> </form-bean>
>> .......
>> .....
>> <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
>> <set-property property="pathnames"
>> value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
>> </plug-in>
>>
>> ------------------------------------------------------
>> validator.xml
>>
>> <form  name="LoginForm">
>> <field property="userId" depends="required,minlength,maxlength">
>> <arg0 key="label.userId" />
>> <arg1 key="${var:minlength}" name="minlength" resource="false" />
>> <var>
>> <var-name>minlength</var-name>
>> <var-value>4</var-value>
>> </var>
>> <arg2 key="${var:maxlength}" name="maxlength" resource="false"/>
>> <var>
>> <var-name>maxlength</var-name>
>> <var-value>10</var-value>
>> </var>
>> </field>
>> <field property="password" depends="required,minlength,maxlength">
>> <arg0 key="label.password"/>
>> <arg1 key="${var:minlength}" name="minlength" resource="false" />
>> <var>
>> <var-name>minlength</var-name>
>> <var-value>4</var-value>
>> </var>
>> <arg2 key="${var:maxlength}" name="maxlength" resource="false"/>
>> <var>
>> <var-name>maxlength</var-name>
>> <var-value>10</var-value>
>> </var>
>> </field>
>> </form>
>> ------------------------------------------------------------
>> resources.properties file
>>
>> #validator errors
>> errors.required = {0} is required.
>> errors.minlength = {0} cann't be less than {1} characters.
>> errors.maxlength = {0} cann't be more than {2} characters.
>> errors.invalid = {0} is invalid.
>>
>> # -- Label messages --
>> label.userId = User ID
>> label.password = Password
>> ----------------------------------------------------------------
>> login.jsp file
>>
>> <html:javascript formName="LoginForm" dynamicJavascript="true"
>> staticJavascript="false" />
>>
>> and i didn't change anything in validation-rules.xml
>>
>>
>> please let me know where i went worng
>>
>> Mallik
>>
>>
> 


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


Mime
View raw message