This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Struts and the fly likes Bizarro date validation issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Bizarro date validation issue" Watch "Bizarro date validation issue" New topic

Bizarro date validation issue

Tony Smith
Ranch Hand

Joined: Mar 15, 2005
Posts: 77
I added some validation rules for dates.
When I run my app, the invalid dates seem to be caught properly, but no text displays. Instead, I just get a blank line at the top of the display where I'd expect to see error text. If I have 3 dates, and they are all invalid, I get 3 blank lines. If I fix a date, one of the blank lines disappears.

I have several other validations - masks, integers, etc, and they work fine. However, all my date validations exhibit the odd behavior.




I put this at the top of my jsp:

Here is an example from validation.xml, which I think is standard:

I have defined the error text. A snippet from the file is

Jason Menard

Joined: Nov 09, 2000
Posts: 6450
"Tony InKY",

Welcome to JavaRanch. We don't have many rules here, but we do have a naming policy which we try to strictly enforce. Please re-read this document and edit your display name in order to comply. Thanks in advance, and we look forward to seeing you around the Ranch.
Tony Smith
Ranch Hand

Joined: Mar 15, 2005
Posts: 77
There ya go, all better now!
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

View the html source of the "blank lines" and let us know what you find.

At the very least it should be <br> or <li> tags.

A good workman is known by his tools.
Tony Smith
Ranch Hand

Joined: Mar 15, 2005
Posts: 77
They are <BR>s

Here's a snippet.

[ March 15, 2005: Message edited by: Tony Smith ]
[ March 15, 2005: Message edited by: Tony Smith ]
Tony Smith
Ranch Hand

Joined: Mar 15, 2005
Posts: 77
Ok, problem solved.

I'm using this type of validation for the first time, and on an application I inherited. Much to my horror, the output text for the standard rules in validation-rules.xml are in Somehow, they got hosed up. The date validation definition was entirely missing and this is why an empty line was produced. The maxlength text was there but was using arguments 0 and 2 for some reason.

I agree. Here's the link:
subject: Bizarro date validation issue
Similar Threads
mask validation not working
'required,intRange' Validation Problems
Struts Date validation using validator
date comparison in struts
Struts: validations using 'validwhen' in validation.xml