This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

validation.xml in validator frame work

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't understand how the Struts Validator framework functions, read This Article from OnJava.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic