You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dean Anderson <dx...@qwest.com> on 2009/09/21 18:18:55 UTC

Velocity Tools Error Question with Struts2

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.

-- 
View this message in context: http://www.nabble.com/Velocity-Tools-Error-Question-with-Struts2-tp25530393p25530393.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org