• 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

maxlength validation not working  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to use the validation framework in my application. I have a jsp page with one field to be validated for lenght. when i implement the maxlength validation, it doesn't work. But the "required ' field validation works...

I have tried the changing the struts.jar, validation-rules.xml etc... Still same...

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!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="MismatchEDIForm">
<field property="isa_date" depends="maxlength">
<arg0 key="mismatchpage.date"/>
<arg1 key="${var:maxlen}" resource="false"/>
<var>
<var-name>maxlen</var-name>
<var-value>6</var-value>
</var>
</field>
</form>
</formset>
</form-validation>
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are two examples that I pulled out of my validation.xml file. The first one uses both required and maxlength. The second just uses maxlength. Note the use of the "name" attribute on the arg1 tag. That might be your problem.


- Brent
 
Pradeep Swaminathan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brent ,

I tried placing the name="maxlength", still its not working .....
Only "required " works....
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also facing similar issue. I created a custom validator to check entered special character and maxlength provided by framework.
Custom one is working but maxlength is not working. I am using struts 1.2.9 version.

Here is validation.xml:


Validator-rules.xml looks like:



Help me to identify why it is not working.
 
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
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!