ActionMessages actionMessages = new ActionMessages(); actionMessages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("product.error.cannotMove")); saveErrors(request, actionMessages); return mapping.findForward("failure");
And I was thinking how nice, performance and organization if I could move a protected instance or even utility method into a base AbstractMappingDispatchAction class that did those 4 steps for me and I just passed in the message key....
So the method would do something like:
actionMessages.clear(); actionMessages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(messageKey)); saveErrors(request, actionMessages); return mapping.findForward(forwardName);
but then I realized that this could be a huge problem if I had (a) a lot of users using the system and (b) struts/servlet container was multithreaded and called 2 methods at the same time that BOTH had errors... I could run into a situation where one method cleared the errors that the other method was trying to return to the user because the actionMessages instance is shared per-class.
Can anyone let me know if my worry IS correct and I should keep everything the way it is, or if I'm safe and can go ahead with it, and "why", if you know.
Thanks! Riyad
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]