You can make your action bean implement ValidationErrorHandler.

Then simply write this in your action bean.
public Resolution handleValidationErrors(ValidationErrors errors) {
    errors.clear();
    errors.addGlobalError(new LocalizableError("errorMessage"));
    return context.getSourcePageResolution();
}

Christian


-----Original Message-----
From: Khan Ahmad [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 09, 2008 1:54 PM
To: [email protected]
Subject: [Stripes-users] Showing a single error message for multiple error 
types in validation

Hi

I am new to stripes and was using the @Validation function to show error for 
fields in a form. This form has 2 fields, username and password. I have used 
validation tags for generating errors, but I do not wish to give too much 
information about what is wrong with the fields because of security issues.
f.ex. I do not want the users to know that the password OR the username was 
typed wrongly or with too few characters. I only wish to show a single error 
message like "Invalid username/password".

I tried to only add the errormessage to
<package>.MySignInActionBean.errorMessage="Invalid username/password"

but this produces multiple error messages equal to different type of errors it 
found (f.ex one for required field, one for invalid character, one for not 
enough character), with the same message "Invalid username/password". I 
understand that this is logical, but how can I make Stripes produce a single 
error message for all kinds of errors?

Regards
Qadeer


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge 
Build the coolest Linux based applications with Moblin SDK & win great prizes 
Grand prize is a trip for two to an Open Source event anywhere in the world 
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to