• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in Struts Declerative validations  RSS feed

ash sangy
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
plase help is there any problem with my validation.xnl file ,i have using struts1.3.8


<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"

<form-bean name="loginform" type="com.myapp.struts.LoginForm"/>
<form-bean name="regform" type="com.myapp.struts.RegistrationForm"/>



<forward name="welcome" path="/Welcome.do"/>

<action name="loginform" path="/login" type="com.myapp.struts.LoginAction" validate="true" input="/login.jsp">
<forward name="home" path="/home.jsp"/>
<action name="regform" path="/reg" type="com.myapp.struts.RegistrationAction" validate="true" input="/home.jsp">
<forward name="success" path="/success.jsp"/>
<forward name="failure" path="/failure.jsp"/>


<message-resources parameter="com/myapp/struts/ApplicationResource"/>

<!-- ========================= Tiles plugin ===============================-->
This plugin initialize Tiles definition factory. This later can takes some
parameters explained here after. The plugin first read parameters from
web.xml, thenoverload them with parameters defined here. All parameters
are optional.
The plugin should be declared in each struts-config file.
- definitions-config: (optional)
Specify configuration file names. There can be several comma
separated file names (default: ?? )
- moduleAware: (optional - struts1.1)
Specify if the Tiles definition factory is module aware. If true
(default), there will be one factory for each Struts module.
If false, there will be one common factory for all module. In this
later case, it is still needed to declare one plugin per module.
The factory will be initialized with parameters found in the first
initialized plugin (generally the one associated with the default
true : One factory per module. (default)
false : one single shared factory for all modules
- definitions-parser-validate: (optional)
Specify if xml parser should validate the Tiles configuration file.
true : validate. DTD should be specified in file header (default)
false : no validation

Paths found in Tiles definitions are relative to the main context.

<!-- ========================= Validator plugin ================================= -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>



<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"



<!-- An example form -->
<form name="regform">
<field property="fname" depends="required">
<arg0 key="fname" resource="true"/>
<field property="lname" depends="required">
<arg0 key="lname" resource="true"/>

<field property="father" depends="required">
<arg0 key="father" resource="true"/>

<field property="g1" depends="required">
<arg0 key="gender" resource="true"/>

<field property="address" depends="required">
<arg0 key="address" resource="true" />

<field property="dob" depends="required,date">
<arg0 key="dob" resource="false" />
<field property="phone" depends="required,mask">
<arg0 key="phone" resource="false"/>

<field property="pin" depends="required,mask">
<arg0 key="pin" resource="false"/>



<!-- An example formset for another locale
<formset language="fr">


An example form
<form name="logonForm">
<arg key="logonForm.username"/>
<arg key="logonForm.password"/>



  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!