Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

validation.xml in validator frame work

 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • 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
 
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.
 
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic