You can use the property attribute of <html:errors/>

In your Action or in your FormBean you save your errors under an appropriate
key :

In an action :

ActionErrors errors = new ActionErrors();

errors.add(Constants.FATAL_LEVEL, new ActionError("...."));
or
errors.add(Constants.ERROR_LEVEL, new ActionError("...."));
or
errors.add(Constants.WARN_LEVEL, new ActionError("...."));
or
errors.add(Constants.INFO_LEVEL, new ActionError("...."));

saveErrors(request,errors);


In a FormBean validation method :

ActionErrors errors = new ActionErrors();

errors.add(Constants.FATAL_LEVEL, new ActionError("...."));
or
errors.add(Constants.ERROR_LEVEL, new ActionError("...."));
or
errors.add(Constants.WARN_LEVEL, new ActionError("...."));
or
errors.add(Constants.INFO_LEVEL, new ActionError("...."));

return errors;

And in your JSP you retreives errors with :

My Fatal errors :
<html:errors property="Constants.FATAL_LEVEL"/>
My Infos :
<html:errors property="Constants.INFO_LEVEL"/>

For your problem with the pop-up window I saw in the mailing list several
month ago someone who done it.
Try to search in the archives.

Arnaud


> -----Message d'origine-----
> De : Puneet Agarwal [mailto:[EMAIL PROTECTED]]
> Envoyé : lundi 23 décembre 2002 11:45
> À : [EMAIL PROTECTED]
> Objet : ActionErrors - <html:errors/>
>
>
> In our application we have to show the errors, warnings, and
> informative messages to the users in a separate pop-up
> modal-window.
> (This is not for logging purpose as provided by Log4J).
>
> If we use ActionErrors, for this purpose, we shall have two
> problems
>
> 1. How to categories them as "Fatal, Errors, Warnings,
> Information".
> 2. <html:errors/>, shows all of them in the same window, how to
> segragate them into different types.
>
> Any help in this regard may help me in getting Struts used in our
> project.
>
> Also if any of the developers, who read this mail, think that
> this features can be developed into struts, I shall be more than
> ready to do this.
>
> I have been working on Struts for past 4-5 months, and have been
> into software industry for only 5 years.
>
> Thanks in Advance
> Puneet
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to