It's not a secret anymore!*
The moose likes Struts and the fly likes Question About  The validation.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Question About  The validation.xml" Watch "Question About  The validation.xml" New topic
Author

Question About The validation.xml

JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
Hi, I am new to Struts. I am working on the validation.xml.
I saw that date and email are pre-defined validators:

date - the field must be able to be cast to a date.
email - the field must contain a valid e-mail address

First, is it correct to do the following:

Second, what is the difference between:

and

I know the key is different. When do we use label.emailAddress and when do we use logonForm.emailAddress?
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4419
    
    5

It depends on what you have in ApplicationResources.properties.
The key is used to look up a value in ApplicationResources.properties so you would use whichever key you need to display the desired error message.


Junilu - [How to Ask Questions] [How to Answer Questions]
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
date and email are pre-defined validators:

date - the field must be able to be cast to a date.
email - the field must contain a valid e-mail address

Is it correct to do the following?
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4419
    
    5

The definition looks OK. Did you try it and not have it work?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Question About The validation.xml
 
Similar Threads
DynaValidatorActionForm not working
how to validate date type parameter with validator
validator plugin and validate() method needs to use together
Email validation using validation.xml
Struts e-mail validator doesn't handle null?