When you use the add method of ActionMessages, the first parameter can be used to categorize the messages. If it is a general error,
you should use the constant ActionMessages.GLOBAL_MESSAGE as the first parameter. If it is an error specific to a property, use the property name as the first parameter (e.g. messages.add("userName", new ActionMessage(...)); ).
Then, in your JSP you can filter what is retrieved in <html:errors> by specifying a property attribute. In the above example, if you specify <html:errors property="userName" /> you will get only userName messages. If you want only global messages, specify:
<html:errors property="<%=org.apache.struts.action.ActionMessages.GLOBAL_MESSAGE %>" />