struts-user mailing list archives

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

Hi, 

      How do I get the "ActionErrors" object which have been saved in the
request.
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));



Thanks,
-Sanjeeb
--
View this message in context: http://www.nabble.com/How-to-get-the-%22ActionErrors%22-object-reference-----t1826184.html#a4981338
Sent from the Struts - User forum at Nabble.com.


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


Mime
View raw message