Within Spring MVC, is there way to identify the ‘level’ or ‘type’ of error? Examples include information, warning, and error messages?
Btw, this is purely for formatting purposes. For example, error messages tend to be in red text while warning messages are simply black.
** Updating for clarity:
In our current system, we have multiple levels of messages: error, warning, info. Is there anything built into SpringMVC, that allows me to set an error message’s level?
Also, it appears that we’re using BindingResults in the Controllers (specifically BeanPropertyBindingResults), and triggering a Validator (our custom class that implements Spring’s Validator interface).
During validation we end up writing something like:
ValidationUtils.rejectIfEmptyOrWhitespace(errors, modelVariable, "required", new Object[] {variableDisplayName});
Or
errors.rejectValue("field", "fieldName");
In the end, we ended up extending ObjectError and FieldError to include a new field, ‘ErrorLevel’. When creating a new error -we use these new objects so that we can set the ErrorLevel. On the JSP, we look for the ErrorLevel to determine how to display the messages.