Wednesday, October 26, 2005

Incoherence in Struts

getMessages(HttpServletRequest) and getErrors(HttpServletRequest) methods from Action class are supposed to return the messages and errors from the request scope. However, you may have saved it in the session scope, since the saveMessages(HttpSession session, ActionMessages messages) method exists and allows you to do that. In this case, if you use saveMessages() (in session scope) and right after use a getMessages(), it will return a new ActionMessages(), with all the previous messages wiped out.

AppFuse has a BaseAction class that implements the correct version of getMessages() and getErrors() and this implementation should be integrated into Struts.

Apache Sofware Foundation Bugzilla: bug 34857
Post a Comment