You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Johnson <ch...@gmail.com> on 2005/05/27 03:48:19 UTC

ActionError in Struts 1.2.7

Hi all
 I notice that ActionError is deprecated in this version.. is there some 
document describing what we should now be doing?
  [javac] 
C:\Builds\riskGrid\src\com\company\struts\form\QueryResultsForm.java:101: 
warning: org.apache.struts.action.ActionError in
org.apache.struts.actionhas been deprecated
[javac] errors.add( ActionErrors.GLOBAL_ERROR, new ActionError("
error.thing.duplicate.name <http://error.thing.duplicate.name>") );
 
-- 
-Dave
ChaChaNY@Gmail.com

Re: ActionError in Struts 1.2.7

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
In the Action there are two convenience methods:

         saveErrors(request, ActionMessages)
         saveMessages(request, ActionMessages)

You cn use the saveMessages() method to store under the messages key.

Niall

----- Original Message ----- 
From: "David Johnson" <ch...@gmail.com>
Sent: Friday, May 27, 2005 5:13 AM

> This opens up the possibility of having errors and messages both stored
> using saveerrors( request, ActionMessages) but what I'm wondering what
> method you'd recommend for separating them?
>
>  I'm using this to display my errors in my jsp:
>     <html-el:messages id="msg" message="false">
>            <c:out value="${msg}"/>
>      </html-el:messages>
>
> but it wouls seem to make more sense to have perhaps two areas in my JSP,
> one reserved for "errors" and one for "messages", like this:
>
>    <html-el:messages id="msg" message="false">
>       <c:out value="${msg}"/>
>    </html-el:messages>
>
>    <html-el:messages id="errors" message="false">
>       <c:out value="${errors}"/>
>    </html-el:messages>
>
>  it would seem that "saveErrors()" saves everything unser the "msg" key by
> default.
>
> Is there any way do override that behavior to store it under a key that
> makes more sense (i.e. I'm saving "errors" under the key=msg which seems
> sketchy)



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


Re: ActionError in Struts 1.2.7

Posted by David Johnson <ch...@gmail.com>.
Niall
 Related to this, I found your article 
http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html VERY 
helpful ant informative. I've refactored my application (yes it's midnight 
in NY) to REMOVE all ActionError references (leavinf the ActionErrors in the 
validate() as you recommend.
 I have a question though
 This opens up the possibility of having errors and messages both stored 
using saveerrors( request, ActionMessages) but what I'm wondering what 
method you'd recommend for separating them?
 I'm using this to display my errors in my jsp:
 <html-el:messages id="msg" message="false"> 
<c:out value="${msg}"/> 
</html-el:messages> 
 but it wouls seem to make more sense to have perhaps two areas in my JSP, 
one reserved for "errors" and one for "messages", like this:
<html-el:messages id="msg" message="false"> 
<c:out value="${msg}"/> 
</html-el:messages> 
<html-el:messages id="errors" message="false"> 
<c:out value="${errors}"/> 
</html-el:messages> 
 it would seem that "saveErrors()" saves everything unser the "msg" key by 
default.
 Is there any way do override that behavior to store it under a key that 
makes more sense (i.e. I'm saving "errors" under the key=msg which seems 
sketchy)
 I understand that I can do this:
ActionMessages am = new ActionMessages(); 
am.add( ActionMessages.GLOBAL_MESSAGE, 
new ActionMessage( "msg.warning" ) ); 
request.setAttribute("warnings", am); 
 but it FEELS like a workaround....
 thoughts?
 On 5/26/05, David Johnson <ch...@gmail.com> wrote: 
> 
> tyvm :> 
> 
> On 5/26/05, Niall Pemberton <ni...@blueyonder.co.uk> wrote: 
> > 
> > It was deprecated in Struts 1.2.4 - theres info about this in the wiki:
> > 
> > http://wiki.apache.org/struts/StrutsUpgradeNotes11to124
> > http://wiki.apache.org/struts/StrutsDeprecatedActionErrors
> > 
> > Niall
> > 
> > ----- Original Message ----- 
> > From: "David Johnson" <ch...@gmail.com>
> > Sent: Friday, May 27, 2005 2:48 AM
> > 
> > 
> > I notice that ActionError is deprecated in this version.. is there some 
> > document describing what we should now be doing?
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org 
> > For additional commands, e-mail: user-help@struts.apache.org
> > 
> > 
> 
> 
> -- 
> -Dave
> ChaChaNY@Gmail.com 




-- 
-Dave
ChaChaNY@Gmail.com

Re: ActionError in Struts 1.2.7

Posted by David Johnson <ch...@gmail.com>.
tyvm :>

On 5/26/05, Niall Pemberton <ni...@blueyonder.co.uk> wrote: 
> 
> It was deprecated in Struts 1.2.4 - theres info about this in the wiki:
> 
> http://wiki.apache.org/struts/StrutsUpgradeNotes11to124
> http://wiki.apache.org/struts/StrutsDeprecatedActionErrors
> 
> Niall
> 
> ----- Original Message -----
> From: "David Johnson" <ch...@gmail.com>
> Sent: Friday, May 27, 2005 2:48 AM
> 
> 
> I notice that ActionError is deprecated in this version.. is there some
> document describing what we should now be doing?
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
-Dave
ChaChaNY@Gmail.com

Re: ActionError in Struts 1.2.7

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
It was deprecated in Struts 1.2.4 - theres info about this in the wiki:

http://wiki.apache.org/struts/StrutsUpgradeNotes11to124
http://wiki.apache.org/struts/StrutsDeprecatedActionErrors

Niall

----- Original Message ----- 
From: "David Johnson" <ch...@gmail.com>
Sent: Friday, May 27, 2005 2:48 AM


 I notice that ActionError is deprecated in this version.. is there some 
document describing what we should now be doing?



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