I am writing an application that requires erroneous user input to be a "hard error" for user class A, but only a warning for user class B.
I have searched high and low for how to handle this, and came across the following "best practices" below.
1. To display the error messages of different categories, define these categories such as FATAL, ERROR, WARNING, or INFO, in an interface.
2. In the Action or form-bean class, you can then use the following:
errors.add("fatal", new ActionError("....")); or
errors.add("error", new ActionError("....")); or
errors.add("warning", new ActionError("....")); or
errors.add("information", new ActionError("...."));
3. To display them according to those categories, use the following code:
I am assuming that the interface mentioned above would be an interface to the ActionMessages class and that the category definitions would just be static variables in the interface. Is this the case? I need to have a way of determining if the collection contains actual errors at submittal to handle the "hard errors" or just display the warnings.