Struts validation not work properly

Struts validation not work properly

hi...

i have a problem with my struts validation framework.
i using struts 1.0...

i have 2 page which is:

1)index.jsp
===================================

<%@ page language="java"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<html:link action="/example.do?actLink=addrecord">[Add record]
</html:link><br>
</body>
</html>


2)add.jsp
================================

<%@ page language="java"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>

<html>
<head>
<title>JSP for exampleForm</title>
<html:javascript formName="exampleForm" />
</head>
<body>
<html:form action="/example" onsubmit="return validateExampleForm(this)">
<html:errors /> <br>
Name: <html:text property="name" /> <br>
Age: <html:text property="age" /> <br>
Email: <html:text property="email" /> <br>
NRIC: <html:text property="nric" /> <br>
Address: <html:text property="address" /> <br>
<html:submit value="Send"/>
</html:form>
</body>
</html>


index.jsp act as my 1st page & when it load it has 1 link [Add record] which will open add.jsp (form). in this add.jsp i have several fields which requires some validation (client side - javascript).

currently i managed to validate 2 fields (name & age). for the rest, when i try to put 1 more validation (let say for email), i could not click on [Add record] link to open add.jsp.

but when i remove it, it can open the add.jsp, it seems like it's only allowed for 2 fields to be validated. what have i missed? is there anything that i forgot...

pls help to advise, i face it for almost a week now...

this is my action class...

========================================

public class ExampleAction extends Action {

public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {


String link = (String) request.getParameter("actLink");

System.out.println("actLink----------->"+link);

return mapping.findForward(link);
}

}


my bean class......
=========================================

public class ExampleForm extends ValidatorForm {

//Eigenschaften der Klasse
private String actLink;

private String name;
private int age;
private String email;
private String nric;
private String address;

public String getActLink() {
return actLink;
}
public void setActLink(String actLink) {
this.actLink = actLink;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getNric() {
return nric;
}
public void setNric(String nric) {
this.nric = nric;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}



my struts-config.xml
======================================
<form-beans >
<form-bean name="exampleForm" type="de.laliluna.tutorial.validatorform.form.ExampleForm" />
</form-beans>

<global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="exampleForm"
input="/form/index.jsp"
name="exampleForm"
path="/example"
scope="request"
type="de.laliluna.tutorial.validatorform.action.ExampleAction" >
<forward name="home" path="/form/index.jsp" />
<forward name="addrecord" path="/form/add.jsp" />
<forward name="link1" path="/form/link1.jsp" />
<forward name="link2" path="/form/link2.jsp" />
</action>


</action-mappings>



my validation.xml
=====================================
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">

<form-validation>
<global>
<!-- An example global constant
<constant>
<constant-name>postalCode</constant-name>
<constant-value>^\d{5}\d*$</constant-value>
</constant>
end example-->
</global>

<formset>
<!-- validation mapping for example form -->
<form name="exampleForm">
<field property="name" depends="required">
<arg0 key="exampleForm.name"/>
</field>
<field property="age" depends="required">
<arg0 key="exampleForm.age"/>
</field>
<field property="email" depends="required">
<arg0 key="exampleForm.email"/>
</field>
</form>
</formset>
</form-validation>
View Answers









Related Tutorials/Questions & Answers:
Struts validation not work properly - Struts
Struts validation not work properly  hi... i have a problem with my struts validation framework. i using struts 1.0... i have 2 page which... add.jsp (form). in this add.jsp i have several fields which requires some validation
sing validator framework work in struts
sing validator framework work in struts  How does client side validation using validator framework work in struts
Advertisements
Struts 2 - Validation - Struts
Struts 2 - Validation annotations  digging for a simple struts 2 validation annotations example
validator framework work in Struts
validator framework work in Struts  How does validator framework work in Struts
Jquery form validation does not work
Jquery form validation does not work  I want to use jquery validation... jquery.validate.min.js I called the functions (validate function) properly. But jquery effect does not work. Could you please solve this problem? Thanks!   
Jquery form validation does not work
Jquery form validation does not work  I want to use jquery validation... jquery.validate.min.js I called the functions (validate function) properly. But jquery effect does not work. Could you please solve this problem? Thanks!   
Validation - Struts
Validation  what is the best way to use validation in Struts?either "validation.xml" or JavaScript
Struts validation
Struts validation  I want to put validation rules on my project.But... validation rules,put the plugins inside strutsconfig.xml, put the html:errors tag... that violate the rules for struts automatic validation.So how I get the solution
validation - Struts
validation  Hi Deepak can you please tell me about struts validations perticularly on server side such as how they work whats their role etc.? thank you
struts validation problem - Struts
struts validation problem  i used client side validation in struts 2 .but message will display only on the top of the component.i want to display.../struts/struts2/ http://www.roseindia.net/struts/struts2/struts-2-client-side-validation
Regarding struts validation - Struts
Regarding struts validation  how to validate mobile number field should have 10 digits and should be start with 9 in struts validation?  Hi... ------------------------------------------------------------- For more information : http://www.roseindia.net/struts/struts_validator
struts validation
struts validation  Sir i am getting stucked how to validate struts using action forms, the field vechicleNo should not be null and it should...://www.roseindia.net/struts/strutsvalidatorframework.shtml http://www.roseindia.net
struts validation
struts validation  I want to apply validation on my program.But i am failure to do that.I have followed all the rules for validation still I am...;%@ include file="../common/header.jsp"%> <%@ taglib uri="/WEB-INF/struts
struts validation
struts validation  I want to apply validation on my program.But i am failure to do that.I have followed all the rules for validation still I am...;%@ include file="../common/header.jsp"%> <%@ taglib uri="/WEB-INF/struts
Validation - Struts
Validation  How can i use validation framework i don't understand am...; Hi friend, Phone validation using javaScript function... return true; } Phone Validation
validation - Struts
information, http://www.roseindia.net/struts/struts-login-form.shtml Thanks
Struts Validation - Struts
Struts Validation  Hi friends.....will any one guide me to use the struts validator...   Hi Friend, Please visit the following links: http://www.roseindia.net/struts/struts_validator_framework.shtml http
what is custom validation in struts
what is custom validation in struts  what is custom validatons in struts
validation problem in struts - Struts
validation problem in struts  hi friends... m working on one project using struts framework. so i made a user login form for user authentication. nd i write d code for sql connection and user athunetication in d action class
struts client side validation
struts client side validation  how can i code for client side validation
server side validation in struts
server side validation in struts  Hello sir, i want to do server side validation in struts based on 3 fields. those 3 field are BatchNo,LotNo,StepNo.Here we can have the same batchno,lotno for different forms
how to work with dynaaction form in lomboz - Struts
how to work with dynaaction form in lomboz  hi friends i have on doubt regarding about how to use and work with struts dynaaction form in lomboz i know how to work with actionform in struts plzzzzzzzzzzzzzzzzzz send reply
Struts2 Validation Problem - Struts
Struts2 Validation Problem  Hi, How to validate field... in the browser having the example of handling the error in struts 2. http... information on Struts 2 visit to : http://www.roseindia.net
student marks sheet genaration in struts frame work
student marks sheet genaration in struts frame work  Hi every body iam using struts frame work back end as oracle 10g xe i wanna urgent code for student marks genaration code please help me thanks in advance
validation problem - Struts
validation problem  i want to create validation class for each action class bot project structure as i create a bean differnt and in action class i... is that in which name i create my validation xml file on bean name or action class name i also
validation message - Struts
validation message  sir, i took help of that example but in that we change only color of the message i want to shift the place of the error message.means all messages are put together at top of the form
Struts 2 Validation
Struts 2 Validation  Hello,I have been learning struts. I have a problem in the validator tag. I have tried tutorials and got those. I have to add the Users to the database. So, have implemented the code. See attachement
Struts validation for j-query tabs data
Struts validation for j-query tabs data  Hi, I want apply struts validation for J-query tabs data while saving into database, can any body tell please
validation using validator-rules.xml - Struts
validation using validator-rules.xml  Hi I am trying to validate my form using Validator-rules.xml. I am using Eclipse 3.0 Struts 1.1 and Tomcat... struts-config.xml
java struts validation - Java Server Faces Questions
java struts validation  i m unable to execute a validation page by struts . so please write u program and create a rar/jar file having all program with procedure and sand me . pls........ i m using bea weblogic 8.1 . my mail
Struts 2 Validation (Int Validator)
Struts 2 Validation (Int Validator)       Struts 2 Framework provides in-built validation functions to validate user.... This section discusses all the validation functions available with Struts 2
Struts 2 Validation Example
Struts 2 Validation Example      ... the form validation code in Struts 2 very easily. We will add the form validation... will see how to generate client side validation code).ADS_TO_REPLACE_1 The Struts
i need a school appication using struts frame work with oracle 10g using myeclipse6.0
i need a school appication using struts frame work with oracle 10g using myeclipse6.0   hi i need a school apllication using struts frame work backend 10g xe using myeclipse 6.0
What are Interceptors in Struts 2 and how do they work?
What are Interceptors in Struts 2 and how do they work? Understanding Struts 2 Interceptors concept is very important in learning the Struts 2. You should... does it works? Interceptors carry out most of the work in Struts 2 framework
struts
struts   Hi how struts flows from jsp page to databae and also using validation ? Thanks Kalins Naik
please check my code is wrong or ok.it was not work .this is form validation in javascript using jsf page
please check my code is wrong or ok.it was not work .this is form validation in javascript using jsf page  <p>?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN
please check my code is wrong or ok.it was not work .this is form validation in javascript using jsf page
Form validation in javascript using jsf page  ?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html
struts
struts  Hi, Here my quation is can i have more than one validation-rules.xml files in a struts application
STRUTS
STRUTS   Validation: user entered as 123.34567 I want the value as 123.34 once the user submits. How you will validate
validation
validation  validation
validation
code.Ok if you use struts then you can use Validation method valid the in put... madu dil, Can you please add code.Ok if you use struts then you can use Validation method valid the in put. otherwise call the javascript onsubmit to check
Why are my variables not dividing properly?
Why are my variables not dividing properly?  Why are my variables not dividing properly
struts - Struts
struts  i want to learn more examples on struts like menu creation and some big application on struts.and one more thing that custom validation and client side validation in struts are not running which are present on rose india
Struts Login Validation. In This code setter of login page is called only one time again it doesnt call it. Why..?
Struts Login Validation. In This code setter of login page is called only one...="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org
validation
validation  we are doing payroll system project in java.So pls provide the complete validation code for employee master form
Regarding tiles and struts - Struts
Regarding tiles and struts  Hi, i have a struts application which... is a tiles page) i am not able to redirect properly it was showing response ...). So, redirect will not work. You can use the action class to conditionally
Struts - Struts
Struts  How to display single validation error message, in stude of ?  Hi friend, I am sending you a link. This link will help you. Please visit for more information. http://www.roseindia.net/struts/struts
Struts - Struts
Struts  Dear Sir , I m very new to struts how to make a program in struts and how to call it in action mapping to to froward another location. Acctually i m using netbeans ide when i select a new web application for struts its
validation using validate method
validation using validate method  HOW TO DO THE VALIDATION IN THE STRUTS 2 USING VALIDATE METHOD IN ACTION CLASS,AND ALSO AM HAVING MY BEAN CLASS AS SEPERATE. I HAD TRIED THAT BUT IT WAS NOT WORKING PROPERLY. IF U KNOW
Struts - Struts
Struts  Dear Sir , I am very new in Struts and want to learn about validation and custom validation. U have given in a such nice way... validation and one of custom validation program, may be i can understand.Plz

Ads