This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

problem in Struts Declerative validations  RSS feed

 
Greenhorn
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


Srruts-config.xnl


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

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">


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

<global-exceptions>

</global-exceptions>

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

<action-mappings>
<action name="loginform" path="/login" type="com.myapp.struts.LoginAction" validate="true" input="/login.jsp">
<forward name="home" path="/home.jsp"/>
</action>
<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"/>
</action>

</action-mappings>


<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
module).
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"/>
</plug-in>

</struts-config>

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"
"http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">

<form-validation>



<formset>

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

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

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

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

</field>
<field property="dob" depends="required,date">
<arg0 key="dob" resource="false" />
<var>
<var-name>datepatternstrict</var-name>
<var-value>dd-mm-yyyy</var-value>
</var>
</field>
<field property="phone" depends="required,mask">
<arg0 key="phone" resource="false"/>

<var>
<var-name>mask</var-name>
<var-value>^\d{2}-\d{10}*$</var-value>
</var>
</field>
<field property="pin" depends="required,mask">
<arg0 key="pin" resource="false"/>

<var>
<var-name>mask</var-name>
<var-value>^[0-9]$</var-value>
</var>
</field>
</form>

</formset>

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

<constant>
<constant-name>postalCode</constant-name>
<constant-value>^[0-9a-zA-Z]*$</constant-value>
</constant>

An example form
<form name="logonForm">
<field
property="username"
depends="required">
<arg key="logonForm.username"/>
</field>
<field
property="password"
depends="required,mask">
<arg key="logonForm.password"/>
<var>
<var-name>mask</var-name>
<var-value>^[0-9a-zA-Z]*$</var-value>
</var>
</field>
</form>

</formset>-->

</form-validation>


 
CLUCK LIKE A CHICKEN! Now look at this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!