This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

plugin validator messages not printing  RSS feed

Bhumika Thakkar
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone,

i have a validation to check if zip belongs to a state.


public static boolean validateZipCodeInState(Object bean,
ValidatorAction va,
Field field,
ActionErrors errors,
HttpServletRequest request) {

String zip = ValidatorUtils.getValueAsString(bean, field.getProperty());
String sProperty2 = field.getVarValue("secondProperty");
String state = ValidatorUtils.getValueAsString(bean, sProperty2);

if (!GenericValidator.isBlankOrNull(zip) && !VALIDATOR.checkZipCodeValidInState(zip, state)) {
// option 1 tried
addError(errors, request, "ActionErrors.GLOBAL_ERROR", Resources.getActionMessage(request, va, field));

//option 2 tried
addError(errors, request, "ActionErrors.GLOBAL_ERROR", new ActionMessage("Error in zip state"));

// option 3 tried
addError(errors, request, field.getKey(),Resources.getActionMessage(request, va, field));

return false;

return true;

protected static final ActionErrors addError(ActionErrors errors, HttpServletRequest request, String key, ActionMessage actionMessage) {
if (errors == null) {
errors = new ActionErrors();
//option 1 tried
request.setAttribute(ActionErrors.GLOBAL_ERROR, errors);
// option 2 tried
request.setAttribute(Globals.ERROR_KEY, errors);

errors.add(key, actionMessage);
request.setAttribute(ActionErrors.GLOBAL_ERROR, errors);
return errors;

in the log messages, it returns false for incorrent zip but still not printing my message on the html form... i've tried a couple of things but in vain.

Please help.

[ November 16, 2005: Message edited by: Bhumika Thakkar ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!