struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sanjeeb Patel <>
Subject How to get the "ActionErrors" object reference ???
Date Wed, 21 Jun 2006 19:56:44 GMT


      How do I get the "ActionErrors" object which have been saved in the
Here is the code below .. I have hard coded for the time being to populate
the "ActionErrors" object.
Once a page populates this "ActionErrors" object how do I get a reference of
this object in one of my JSP 
Controller class ? I Can't do a request.getAttribute as the paramenter it
takes is a "string".

Any ideas .. Please help.

        ActionErrors errors = new ActionErrors();

        // For test purpose .. Adding Errors to the ActionErrors object
        //Hard Coded for the time being  .. ActionErrors object will be
populated from different pages
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(ERROR1));
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(ERROR2));
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(ERROR3));
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(ERROR4));
        saveErrors(request, errors);

        // JSP Controller class.
	//Count the total number of messages in the ActionErrors object
	ActionMessages errorMessages = errors;
        int errorCount = errorMessages.size();
        request.setAttribute("errorCount", Integer.valueOf(errorCount));

View this message in context:
Sent from the Struts - User forum at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message