struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manish Singla <Manish.Sin...@Sun.COM>
Subject Re: ActionErrors and Servlet Filters
Date Sat, 27 Sep 2003 10:06:36 GMT
In addition to below reply:
you may set  name in html:error and .
request.setAttribute(name, errors)
errors can be string, string[], ActionErrors, ErrorMesssages

Manish Singla wrote:

> you may use following
> request.setAttribute(Globals.ERROR_KEY, errors);
> to set global parameter of errors..
>
> set action error as usual...
>
> Nate Drake wrote:
>
> > I have a Servlet Filter that checks that the user has permission to
> > access the requested page.  If the user does not, I want to send them
> > back to home.jsp.  In home.jsp, I want to use the <html:errors> tag to
> > display an error message.
> >
> > In the filter I do this:
> >
> > ActionError error = new ActionError(Constants.ERRORS_PERMISSION_DENIED);
> >
> > ActionErrors errors = new ActionErrors();
> > errors.add(ActionErrors.GLOBAL_ERROR, error);
> >
> > request.setAttribute("errparam", errors);
> >
> > RequestDispatcher rd = request.getRequestDispatcher("home.jsp");
> >
> > rd.forward(request, response);
> > return;
> >
> > In home.jsp I've tried both:
> >
> > <html:errors name="errparam"/>
> > <html:errors property="errparam"/>
> >
> > It forwards back to home.jsp, but the error messages are not displayed.
> > Is it possible to use ActionErrors outside of an Action?
> >
> > Thanks,
> > Nate
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org


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


Mime
View raw message