Привет, у меня ниже псевдокод с исключениями вроде этого
throw new MyException("Bad thing happened","com.stuff.errorCode");
, где MyException расширяет класс Exception. Ниже описано, как я обрабатываю исключение
ActionMessages errors = new ActionMessages();
if(ex.getErrorCode() != null && !"".equals(ex.getErrorCode()))
error = new ActionMessage(ex.getErrorCode()); // com.stuff.errorCode is the errorCode
else
error = new ActionMessage(ex.getMessage()); //"Bad thing happened" is error message
errors.add(ActionMessages.GLOBAL_MESSAGE, error);
//errors.add(Globals.MESSAGE_KEY, error );
saveErrors( requ, errors );
return (mapping.findForward(nextScreen));
Теперь на экране пользователя появляется сообщение
??? en_US. Что случилось ???
Я использую Struts 1.2.4 и изучаю его исходный код, но любой указатель будет высоко оценен.