Here is how I normally handle something like this:
public ActionForward getWidgets(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception
{
ActionMessages errors = new ActionMessages();
ActionForward forward = new ActionForward();
try
{
List widgets=WidgetManager.getWidgets();
forward = mapping.findForward("gotthem");
}
catch (NoWidgetsFoundException e)
{
errors.add("noWidgetsLeftError", new ActionMessage("error.noWidgetsLeftError"));
saveErrors(request, errors);
}
return (forward);
}
My WidgetManager.getWidgets() throws a NoWidgetsFoundException. That is caught in the Action and then you create a new ActionMessage. The message that is going to be displayed is still in the ApplicationResource.properties file, just like the errors you collect in the Form.validate() method.