You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tamilselvan Radha Krishnan <Ta...@igate.com> on 2006/11/30 16:00:11 UTC

ActionErrors and ActionMessages not working.

Hi,
I'm using struts 1.2 version and currently held up in a minor issue but
I could not figure out what i'm missing.
In the code snippet below, From Action class I'm adding an ActionErrors
to display an Error message in the JSP.  In JSP I've a message Tag with
<logic:messagesPresent property="error"> correctly.

The Action is correctly associated to a ActionForm. But when I forward
to JSP after saveErrors(), it throws a ClassCastException as below.  I'm
using the same code in some other Action class, it is working fine.

Can anyone guide me. Thanks.

java.lang.ClassCastException

      at
org.apache.struts.taglib.html.ErrorsTag.doStartTag(ErrorsTag.java:224)

      at
org.apache.jsp.jsp.internal.reports.LoanActivitySearch_jsp._jspx_meth_ht
ml_errors_0(LoanActivitySearch_jsp.java:731)

      at
org.apache.jsp.jsp.internal.reports.LoanActivitySearch_jsp._jspService(L
oanActivitySearch_jsp.java:244)

      at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)


Code snippet from Action class:
ActionErrors errors = new ActionErrors();
if(resultHashMap.get(MyAccConstants.ERRORS_KEY) != null) {
 		String errorCode = null;
		ErrorDetail[] errorDetails = (ErrorDetail[])
resultHashMap.get(MyAccConstants.ERRORS_KEY);
		if (errorDetails != null && errorDetails.length > 0) {
				int errorSize = errorDetails.length;
				for (int index = 0; index < errorSize;
index++) {
				errorCode =
errorDetails[index].getErrorCode();
	errors.add("error", new ActionMessage("error.code."+
errorCode));
	}
}
saveErrors(request, errors);
}
return mapping.findForward(ActionConstants.SUCCESS);

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Information transmitted by this EMAIL is proprietary to iGATE Group of Companies and is intended for use only by the individual 
or entity to whom it is addressed and may contain information that is privileged, confidential, or exempt from disclosure under 
applicable law. If you are not the intended recipient of this EMAIL immediately notify the sender at iGATE or mailadmin@igate.com 
and delete this EMAIL including any attachments
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


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