HttpServletRequest
object's attributes are used to pass error messages from Java programs to other OFBiz resources, including web pages. By convention, error messages are passed as either a single HttpServletRequest
attribute name/value
pair (where the name is _ERROR_MESSAGE_)
or as a list of messages (where the name of the list is _ERROR_MESSAGE_LIST_)
. All HttpServletRequest
object attributes are assumed to be Java Strings.
While you may pass error messages in any fashion you like, the consolidation of error messages and message lists for consumption by other OFBiz resources is made easier if you follow some simple rules:
1. From within an Event, set the appropriate
HttpServletRequest
attribute as shown:request.setAttribute("_ERROR_MESSAGE_", "Error: This is an error message"); // Or pass a list of error messages List myErrors = UtilMisc.toList("This is an error message", "This is another error message"); request.setAttribute("_ERROR_MESSAGE_LIST_...