aspose file tools*
The moose likes Struts and the fly likes validation.xml in validator frame work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "validation.xml in validator frame work" Watch "validation.xml in validator frame work" New topic
Author

validation.xml in validator frame work

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

hi All,

this is my validation.xml
-----------------------------------------------------------------------

<formset>

<form name="employeeForm">
<field
property="employeeid"
depends="required">
<arg key="employeeForm.employeeid"/>
</field>
<field
property="name"
depends="required">
<arg key="employeeForm.name"/>
</field>
<field
property="phone"
depends="required">
<arg key="employeeForm.phone"/>
</field>
<field
property="email"
depends="required">
<arg key="employeeForm.email"/>
</field>
<field
property="depid"
depends="required">
<arg key="employeeForm.depid"/>
</field>
<field
property="experience"
depends="required">
<arg key="employeeForm.experience"/>
</field>
<field
property="fathername"
depends="required">
<arg key="employeeForm.fathername"/>
</field>
<field
property="skills"
depends="required">
<arg key="employeeForm.skills"/>
</field>
<field
property="gender"
depends="required">
<arg key="employeeForm.gender"/>
</field>
<field
property="qualification"
depends="required">
<arg key="employeeForm.qualification"/>
</field>
<field
property="marital"
depends="required">
<arg key="employeeForm.marital"/>
</field>
<field
property="taddr"
depends="required">
<arg key="employeeForm.taddr"/>
</field>
<field
property="paddr"
depends="required">
<arg key="employeeForm.paddr"/>
</field>
<field
property="dob"
depends="required">
<arg key="employeeForm.dob"/>
</field>
<field
property="doj"
depends="required">
<arg key="employeeForm.doj"/>
</field>
</form>
</formset>
-------------------------------------------------------------

this is my Application Resource

-----------------------------------------------------------

employeeForm.employeeid=EmployeeID is Required
employeeForm.name=Name is Required
employeeForm.phone=Phone is Required
employeeForm.email=Email is Required
employeeForm.depid=Department is Required
employeeForm.experience=Experience is Required
employeeForm.fatherName=FatherName is Required
employeeForm.skills=Skill is Required
employeeForm.gender=Gender is Required
employeeForm.qualification=Qualification is Required
employeeForm.marital=Marital status is Required
employeeForm.taddr=Temp.Address is Required
employeeForm.paddr=Perm.Address is Required
employeeForm.dob=DOB is Required
employeeForm.doj=Enter DateOfJoin
----------------------------------------------------------------------

Here is my struts-contig.xml
-----------------------------------------------------
<!-- ========================= 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>

---------------------------------------------

but when i submit my jsp without input..i get js window but there is nomessage!!!

my jsp Here
-----------------------------------
<%--
Document : zaddemployee,
Created on : Mar 31, 2008,
Company : Technoforte Software,
Author : Seetharaman.
--%>

<%@ page language="java" pageEncoding="ISO-8859-1"%>

<%@ 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" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %>

<jsp:include page="/header.jsp"/>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
<head>
<html:base />

<title><bean:message key="app.title"/></title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css"> -->


<link rel="stylesheet" type="text/css" href="./styles/global.css">







</head>

<body>

<div id="content">
<html:errors/>
<html:form action="/Add" method="post" onsubmit="return validateEmployeeForm(this);">
//some text fields here.......

<!-- validation -->
<html:javascript formName="employeeForm"/>

<!-- validation -->



</html:html>
------------------------------------------------

please can anyone explain me

thanks & regards,
seetharaman
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If you don't understand how the Struts Validator framework functions, read This Article from OnJava.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: validation.xml in validator frame work
 
Similar Threads
Validation framework not working for login screen
Help with validation rules for form with multiple submit buttons
Validation framework is not working
Cannot load a validator resource
validation message