*
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
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: 4442
    
    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: 4442
    
    5

The definition looks OK. Did you try it and not have it work?
 
 
subject: Question About The validation.xml
 
Similar Threads
Struts e-mail validator doesn't handle null?
validator plugin and validate() method needs to use together
how to validate date type parameter with validator
DynaValidatorActionForm not working
Email validation using validation.xml