While my colleague is waiting to get added to this list, he asked me to post 
this question on his behalf.

He is trying to access the error info from a Struts2 controller, and is having 
the issues below:

Thanks,

Tim

I'm having trouble accessing the validationAware errors that are generated in 
an Action class.

GenericAction.java

declaration:
GenericLogin extends ActionSupport implements ServletRequestAware, 
ServletResponseAware, ServletContextAware, ValidationAware

Code:
  addFieldError("ERROR_MSG_HEADER", 
"/qCmsRepository/Global/Messages/Errors/error.errorMessageHeader.vm");
  addFieldError("FIELD_TEST", 
"/qCmsRepository/Global/Messages/Errors/error.systemFailure.vm");



Velocity Tool

TestErrorTool.java

declaration:
TestErrorToolextends ActionSupport implements ValidationAware

if (hasFieldErrors())
{
      Map errorMap = getFieldErrors();
      String cmsErrorMessagePath = "";
      List fieldErrorList = (List)errorMap.get(errorKey);
      Iterator errorIterator = fieldErrorList.iterator();
      while (errorIterator.hasNext())
      {
           cmsErrorMessagePath = (String)errorIterator.next();
           System.out.println("ErrorKey: " + errorKey);
           System.out.println("ErrorMessagePath: " + cmsErrorMessagePath);
       }
}

I cannot access the validationAware object when I get to the Velocity Tool.
When you examie hasFieldErrors() it returns false.  When I look at the objects 
in debug mode, the validationAware error, message & fieldErrors are NULL.

In the next step, the Interceptor, the validationAware objects are available 
again.

How do I get access to the ValidationAware objects that I set in the action 
class in the Velocity Tool?

Any help is appreciated.

Reply via email to