Re: struts2: how to return an validate-error if user entered incorrect email format?

2008-01-15 Thread Laurie Harper

xianwinwin wrote:

I would like to validate if the user has entered a valid email.
for this I have the method


@TypeConversion(converter = 
com.utilities.conversion.EmailTypeConversion)
public void setEmail(String email) {
this.email = email;
}


the conversion (where I'm a bit perplexed) is:

..
..
@Override
public String convertToString(Map context, Object o)
{
System.out.println(hey - I'm checking the convert to 
string!!!);
 boolean isEmailValid =
ValidateEmail.isEmailValid(values[0]);
//what comes here? ??
}

assuming the  isEmailValid is false, how can I advise that the validation
failed?
thanks 


Why are you trying to do validation with a type converter? If you want 
to validate that the user has entered a valid email, use validation -- 
specifically, the email validator:


http://struts.apache.org/2.x/docs/validation.html
http://struts.apache.org/2.x/docs/email-validator.html

L.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



struts2: how to return an validate-error if user entered incorrect email format?

2008-01-14 Thread xianwinwin

I would like to validate if the user has entered a valid email.
for this I have the method


@TypeConversion(converter = 
com.utilities.conversion.EmailTypeConversion)
public void setEmail(String email) {
this.email = email;
}


the conversion (where I'm a bit perplexed) is:

.
.
@Override
public String convertToString(Map context, Object o)
{
System.out.println(hey - I'm checking the convert to 
string!!!);
 boolean isEmailValid =
ValidateEmail.isEmailValid(values[0]);
//what comes here? ??
}

assuming the  isEmailValid is false, how can I advise that the validation
failed?
thanks 
-- 
View this message in context: 
http://www.nabble.com/struts2%3A-how-to-return-an-validate-error-if-user-entered-incorrect-email-format--tp14821019p14821019.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]