You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Arindam Samanta <Ar...@skytechsolutions.co.in> on 2005/05/10 11:46:36 UTC
ERROR: Server side validation using Validation framework
Hi,
I am new in struts. I am getting 'Page can not be displayed error when I
click on 'SAVE' button. validation is working fine when I implemented
client side validation to add following line
<html:javascript staticJavascript="true" dynamicJavascript="true"
formName="loginForm"/>
But when I removed above code from jsp I faced page not found error but it
is not throwing any error into server. My Form class extends from
ValidatorForm. My xml are,
********************struts-config.xml***********************
<form-bean name="loginForm" type="com.ual.mars.form.LoginForm"/>
<!-- ========== Action Mapping Definitions
============================== -->
<action-mappings>
<action
path="/login"
type="com.ual.mars.action.LoginAction"
scope="request"
name="loginForm"
validate="true"
input="/login.jsp">
<forward name="Success" path="/jsp/employeedeatils.jsp"
redirect="true"/>
<forward name="Failure" path="/jsp/loginform.jsp"
redirect="true"/>
</action>
************************validation.xm*******************************
<form-validation>
<global>
<constant>
</constant>
</global>
<formset>
<form name="loginForm">
<field
property="userName"
depends="required,mask">
<arg0 key="userName.problem"/>
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z]*$</var-value>
</var>
</field>
<field
property="password"
depends="required,mask">
<arg0 key="password.problem"/>
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z]*$</var-value>
</var>
</field>
</form>
</formset>
</form-validation>
********************validator-rules.xml*******************
<validator name="required"
classname="org.apache.struts.validator.FieldChecks"
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">
<javascript><![CDATA[
function validateRequired(form) {
var bValid = true;
.....
....
*****************
Please help me.
Thanks,
Arindam
RE: ERROR: Server side validation using Validation framework
Posted by Arindam Samanta <Ar...@skytechsolutions.co.in>.
Thank you David. Yaa, I have done mistake with input attribute. It is
working fine now.
Thanks,
Arindam
"David G. Friedman" <hu...@ix.netcom.com>
05/11/2005 04:07 AM
Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>
To
"Struts Users Mailing List" <us...@struts.apache.org>
cc
Subject
RE: ERROR: Server side validation using Validation framework
Your input list "/login.jsp" but your other JSP's are listed under the
/jsp
directory, SO, should your input be something different to get rid of the
page not found error BEFORE you mess with the Validator and claim it is
the
source of all problems?
Instead of:
input="/login.jsp"
Is the file here (like your other examples for "Success" and Failure"):
input="/jsp/login.jsp"
Also, are you sure your action is forwarding to the "success" forward
using
the correct CASE-sensitive spelling (i.e. "Success" not "success") ?
Regards,
David
-----Original Message-----
From: Arindam Samanta [mailto:Arindam.Samanta@skytechsolutions.co.in]
Sent: Tuesday, May 10, 2005 5:47 AM
To: Struts Users Mailing List
Subject: ERROR: Server side validation using Validation framework
Hi,
I am new in struts. I am getting 'Page can not be displayed error when I
click on 'SAVE' button. validation is working fine when I implemented
client side validation to add following line
<html:javascript staticJavascript="true" dynamicJavascript="true"
formName="loginForm"/>
But when I removed above code from jsp I faced page not found error but it
is not throwing any error into server. My Form class extends from
ValidatorForm. My xml are,
********************struts-config.xml***********************
<form-bean name="loginForm" type="com.ual.mars.form.LoginForm"/>
<!-- ========== Action Mapping Definitions
============================== -->
<action-mappings>
<action
path="/login"
type="com.ual.mars.action.LoginAction"
scope="request"
name="loginForm"
validate="true"
input="/login.jsp">
<forward name="Success" path="/jsp/employeedeatils.jsp"
redirect="true"/>
<forward name="Failure" path="/jsp/loginform.jsp"
redirect="true"/>
</action>
************************validation.xm*******************************
<form-validation>
<global>
<constant>
</constant>
</global>
<formset>
<form name="loginForm">
<field
property="userName"
depends="required,mask">
<arg0 key="userName.problem"/>
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z]*$</var-value>
</var>
</field>
<field
property="password"
depends="required,mask">
<arg0 key="password.problem"/>
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z]*$</var-value>
</var>
</field>
</form>
</formset>
</form-validation>
********************validator-rules.xml*******************
<validator name="required"
classname="org.apache.struts.validator.FieldChecks"
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">
<javascript><![CDATA[
function validateRequired(form) {
var bValid = true;
.....
....
*****************
Please help me.
Thanks,
Arindam
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: ERROR: Server side validation using Validation framework
Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Your input list "/login.jsp" but your other JSP's are listed under the /jsp
directory, SO, should your input be something different to get rid of the
page not found error BEFORE you mess with the Validator and claim it is the
source of all problems?
Instead of:
input="/login.jsp"
Is the file here (like your other examples for "Success" and Failure"):
input="/jsp/login.jsp"
Also, are you sure your action is forwarding to the "success" forward using
the correct CASE-sensitive spelling (i.e. "Success" not "success") ?
Regards,
David
-----Original Message-----
From: Arindam Samanta [mailto:Arindam.Samanta@skytechsolutions.co.in]
Sent: Tuesday, May 10, 2005 5:47 AM
To: Struts Users Mailing List
Subject: ERROR: Server side validation using Validation framework
Hi,
I am new in struts. I am getting 'Page can not be displayed error when I
click on 'SAVE' button. validation is working fine when I implemented
client side validation to add following line
<html:javascript staticJavascript="true" dynamicJavascript="true"
formName="loginForm"/>
But when I removed above code from jsp I faced page not found error but it
is not throwing any error into server. My Form class extends from
ValidatorForm. My xml are,
********************struts-config.xml***********************
<form-bean name="loginForm" type="com.ual.mars.form.LoginForm"/>
<!-- ========== Action Mapping Definitions
============================== -->
<action-mappings>
<action
path="/login"
type="com.ual.mars.action.LoginAction"
scope="request"
name="loginForm"
validate="true"
input="/login.jsp">
<forward name="Success" path="/jsp/employeedeatils.jsp"
redirect="true"/>
<forward name="Failure" path="/jsp/loginform.jsp"
redirect="true"/>
</action>
************************validation.xm*******************************
<form-validation>
<global>
<constant>
</constant>
</global>
<formset>
<form name="loginForm">
<field
property="userName"
depends="required,mask">
<arg0 key="userName.problem"/>
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z]*$</var-value>
</var>
</field>
<field
property="password"
depends="required,mask">
<arg0 key="password.problem"/>
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z]*$</var-value>
</var>
</field>
</form>
</formset>
</form-validation>
********************validator-rules.xml*******************
<validator name="required"
classname="org.apache.struts.validator.FieldChecks"
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">
<javascript><![CDATA[
function validateRequired(form) {
var bValid = true;
.....
....
*****************
Please help me.
Thanks,
Arindam
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org