You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tim Christopher <ti...@gmail.com> on 2005/02/04 01:12:03 UTC

ActionError / ActionMessage

Hi,

Can anyone let me know when an ActionError should be used in place of
an ActionMessage, or visa versa.  It seems like the ActionMessage is
preferred as it does not encourage markup to be placed within the
resources file.

Does this mean I should always use the ActionMessage, or does the
ActionError come in useful for certain situations?

Tim

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


Re: ActionError / ActionMessage

Posted by Corey Probst <cp...@gmail.com>.
> 
> Does this mean I should always use the ActionMessage, or does the
> ActionError come in useful for certain situations?
> 

ActionError was deprecated in version 1.2.0.  Even if you are using a
version prior to this you should still use ActionMessage for future
considerations.  ActionErrors would be deprecated but it is part of
the ActionForm.validate() signature.

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

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


Re: ActionError / ActionMessage

Posted by Tim Christopher <ti...@gmail.com>.
> removing ActionError and ActionErrors, as they are the 
> cause of way too much confusion.

What sort of confusion?  As far as I can tell they are basically the
same as ActionMessages...


On Fri, 4 Feb 2005 07:46:23 -0600, Joe Germuska <Jo...@germuska.com> wrote:
> In short, ActionError is totally deprecated and should never be used.
> ActionMessage is the preferred replacement for it.
> 
> ActionErrors (a collection of ActionMessage objects) has not been
> deprecated yet because it is part of the public API of the ActionForm
> class (it is the return value from validate).  In Struts 1.3, it is
> expected that the ActionForm will get a method like "public boolean
> validate(ActionContext)" in which the ActionContext both carries
> references to any "input" data that the form needs for validation, as
> well as being where any validation errors should be stored (rather
> than being returned.)  The boolean return would be a shorthand way of
> indicating whether the validation passed or not.
> 
> Once this is done, we will be able to fully deprecate ActionErrors,
> and hopefully move swiftly (but not too swiftly, given the interest
> in smooth migrations) towards simply removing ActionError and
> ActionErrors, as they are the cause of way too much confusion.
> 
> Joe
> 
> At 2:10 AM +0100 2/4/05, Laurent wrote:
> >Tim Christopher wrote:
> >>Hi,
> >>
> >>Can anyone let me know when an ActionError should be used in place of
> >>an ActionMessage, or visa versa.  It seems like the ActionMessage is
> >>preferred as it does not encourage markup to be placed within the
> >>resources file.
> >>
> >>Does this mean I should always use the ActionMessage, or does the
> >>ActionError come in useful for certain situations?
> >
> >Yes. ActionError is deprecated.
> >http://struts.apache.org/api/org/apache/struts/action/ActionError.html
> >
> >However you may still use 'ActionErrors' to store you
> >'ActionMessage's that represent an error, but note that
> >     saveErrors(HttpServletRequest, ActionErrors)
> >is deprecated in favour of
> >     saveErrors(HttpServletRequest, ActionMessages)
> >(which still has 'Errors' in it's name!)
> >This means you probably have to call it with
> >     saveErrors(request, (ActionMessages)actionErrors)
> >(as ActionErrors is a subclass of ActionMessages anyway!)
> >(ActionError was also a subclass of ActionMessage)
> >
> >
> >All this seems odd, so please correct me if I'm wrong.
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> 
> --
> Joe Germuska
> Joe@Germuska.com
> http://blog.germuska.com
> "Narrow minds are weapons made for mass destruction"  -The Ex
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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


Re: ActionError / ActionMessage

Posted by Joe Germuska <Jo...@Germuska.com>.
In short, ActionError is totally deprecated and should never be used.
ActionMessage is the preferred replacement for it.

ActionErrors (a collection of ActionMessage objects) has not been 
deprecated yet because it is part of the public API of the ActionForm 
class (it is the return value from validate).  In Struts 1.3, it is 
expected that the ActionForm will get a method like "public boolean 
validate(ActionContext)" in which the ActionContext both carries 
references to any "input" data that the form needs for validation, as 
well as being where any validation errors should be stored (rather 
than being returned.)  The boolean return would be a shorthand way of 
indicating whether the validation passed or not.

Once this is done, we will be able to fully deprecate ActionErrors, 
and hopefully move swiftly (but not too swiftly, given the interest 
in smooth migrations) towards simply removing ActionError and 
ActionErrors, as they are the cause of way too much confusion.

Joe

At 2:10 AM +0100 2/4/05, Laurent wrote:
>Tim Christopher wrote:
>>Hi,
>>
>>Can anyone let me know when an ActionError should be used in place of
>>an ActionMessage, or visa versa.  It seems like the ActionMessage is
>>preferred as it does not encourage markup to be placed within the
>>resources file.
>>
>>Does this mean I should always use the ActionMessage, or does the
>>ActionError come in useful for certain situations?
>
>Yes. ActionError is deprecated.
>http://struts.apache.org/api/org/apache/struts/action/ActionError.html
>
>However you may still use 'ActionErrors' to store you 
>'ActionMessage's that represent an error, but note that
>     saveErrors(HttpServletRequest, ActionErrors)
>is deprecated in favour of
>     saveErrors(HttpServletRequest, ActionMessages)
>(which still has 'Errors' in it's name!)
>This means you probably have to call it with
>     saveErrors(request, (ActionMessages)actionErrors)
>(as ActionErrors is a subclass of ActionMessages anyway!)
>(ActionError was also a subclass of ActionMessage)
>
>
>All this seems odd, so please correct me if I'm wrong.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org


-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"Narrow minds are weapons made for mass destruction"  -The Ex

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


Re: ActionError / ActionMessage

Posted by Corey Probst <cp...@gmail.com>.
> If so does anyone know why locale is now deprecated?

A locale attribute of true stores a Locale object in the session and
creates that session if it doesn't exist.  This is not a good thing
for apps that don't support them.

Use the lang attribute to correctly accomplish this.

http://struts.apache.org/userGuide/struts-html.html#html

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


Re: ActionError / ActionMessage

Posted by Tim Christopher <ti...@gmail.com>.
Am I right in thinking that HtmlTag relates to the <html:html> element?
>> http://struts.apache.org/api/org/apache/struts/taglib/html/HtmlTag.html

If so does anyone know why locale is now deprecated?

On Fri, 04 Feb 2005 02:10:31 +0100, Laurent <lg...@free.fr> wrote:
> Tim Christopher wrote:
> > Hi,
> >
> > Can anyone let me know when an ActionError should be used in place of
> > an ActionMessage, or visa versa.  It seems like the ActionMessage is
> > preferred as it does not encourage markup to be placed within the
> > resources file.
> >
> > Does this mean I should always use the ActionMessage, or does the
> > ActionError come in useful for certain situations?
> 
> Yes. ActionError is deprecated.
> http://struts.apache.org/api/org/apache/struts/action/ActionError.html
> 
> However you may still use 'ActionErrors' to store you 'ActionMessage's
> that represent an error, but note that
>     saveErrors(HttpServletRequest, ActionErrors)
> is deprecated in favour of
>     saveErrors(HttpServletRequest, ActionMessages)
> (which still has 'Errors' in it's name!)
> This means you probably have to call it with
>     saveErrors(request, (ActionMessages)actionErrors)
> (as ActionErrors is a subclass of ActionMessages anyway!)
> (ActionError was also a subclass of ActionMessage)
> 
> All this seems odd, so please correct me if I'm wrong.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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


Re: ActionError / ActionMessage

Posted by Laurent <lg...@free.fr>.
Tim Christopher wrote:
> Hi,
> 
> Can anyone let me know when an ActionError should be used in place of
> an ActionMessage, or visa versa.  It seems like the ActionMessage is
> preferred as it does not encourage markup to be placed within the
> resources file.
> 
> Does this mean I should always use the ActionMessage, or does the
> ActionError come in useful for certain situations?

Yes. ActionError is deprecated.
http://struts.apache.org/api/org/apache/struts/action/ActionError.html

However you may still use 'ActionErrors' to store you 'ActionMessage's 
that represent an error, but note that
     saveErrors(HttpServletRequest, ActionErrors)
is deprecated in favour of
     saveErrors(HttpServletRequest, ActionMessages)
(which still has 'Errors' in it's name!)
This means you probably have to call it with
     saveErrors(request, (ActionMessages)actionErrors)
(as ActionErrors is a subclass of ActionMessages anyway!)
(ActionError was also a subclass of ActionMessage)


All this seems odd, so please correct me if I'm wrong.

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