You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Emi Lu <em...@encs.concordia.ca> on 2011/07/12 17:39:19 UTC

addActionMessage does not show message after redirect (struts2.2.3)

Hello List,

Struts2.2.3, it seems that addActionMessage does not show message after 
redirect.

Someone knows why?

Thank you,
Emi

====================
Action.java
this.addActionMessage(this.getText("UPDATE.SUCCESS"));
return forward_str;


<action name="*Action"  method="{1}" class="Action">
  ....
  <result name="forward_str" type="redirectAction">
    <param name="actionName">Action2</param>
    <param name="namespace">/Action</param>
  </result>
</action>

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


Re: addActionMessage does not show message after redirect (struts2.2.3)

Posted by Dave Newton <da...@gmail.com>.
I'll need to be convinced that using a stock interceptor stack, and
prototype-scope actions (if using Spring), will keep something in the
request across requests.

Dave

On Tue, Jul 12, 2011 at 11:45 AM, Emi Lu <em...@encs.concordia.ca> wrote:
> It works for 2.2.1, but the message does not shown for 2.2.3 anymore! Is it
> a bug? I have a lots classes depend on it.
>
> Thanks a lot!
> Emi
>
>
>
> On 07/12/2011 11:39 AM, Emi Lu wrote:
>>
>> Hello List,
>>
>> Struts2.2.3, it seems that addActionMessage does not show message after
>> redirect.
>>
>> Someone knows why?
>>
>> Thank you,
>> Emi
>>
>> ====================
>> Action.java
>> this.addActionMessage(this.getText("UPDATE.SUCCESS"));
>> return forward_str;
>>
>>
>> <action name="*Action" method="{1}" class="Action">
>> ....
>> <result name="forward_str" type="redirectAction">
>> <param name="actionName">Action2</param>
>> <param name="namespace">/Action</param>
>> </result>
>> </action>
>
>
> --
> Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
> emilu@encs.concordia.ca        +1 514 848-2424 x5884
>
> ---------------------------------------------------------------------
> 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: addActionMessage does not show message after redirect (struts2.2.3)

Posted by Emi Lu <em...@encs.concordia.ca>.
It works for 2.2.1, but the message does not shown for 2.2.3 anymore! Is 
it a bug? I have a lots classes depend on it.

Thanks a lot!
Emi



On 07/12/2011 11:39 AM, Emi Lu wrote:
> Hello List,
>
> Struts2.2.3, it seems that addActionMessage does not show message after
> redirect.
>
> Someone knows why?
>
> Thank you,
> Emi
>
> ====================
> Action.java
> this.addActionMessage(this.getText("UPDATE.SUCCESS"));
> return forward_str;
>
>
> <action name="*Action" method="{1}" class="Action">
> ....
> <result name="forward_str" type="redirectAction">
> <param name="actionName">Action2</param>
> <param name="namespace">/Action</param>
> </result>
> </action>


-- 
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
emilu@encs.concordia.ca        +1 514 848-2424 x5884

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


Re: addActionMessage does not show message after redirect (struts2.2.3)

Posted by Dale Newfield <da...@newfield.org>.
On 7/12/11 12:57 PM, stanlick@gmail.com wrote:
> what Struts/2 needs is a simple FlashScope that allows a request to last two
> life-cycles.

Unfortunately most "pages" are a result of many requests (images, 
stylesheets, ajax requests, scripts, etc.), so that constant number (2, 
7, 99, whatever) will never be the right number.

-Dale

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


Re: addActionMessage does not show message after redirect (struts2.2.3)

Posted by Emi Lu <em...@encs.concordia.ca>.
On 07/12/2011 01:21 PM, Dave Newton wrote:
> Do you understand /why/ we're saying it? IMO it'd be beneficial to
> understand why you're seeing a "change" in behavior.

There were a long discuss about this issue in several emails long time 
ago. I will try to find them and forwarded them to you.

Users had provided reasons why addActionMessage words and why 
addActionError did not return the message.

Emi



>
> On Jul 12, 2011 1:17 PM, "Emi Lu" <emilu@encs.concordia.ca
> <ma...@encs.concordia.ca>> wrote:
>  > Thank you for all inputs! All right, I will have to change my codes.
>  >
>  > Emi
>  >
>  >
>  > On 07/12/2011 12:57 PM, stanlick@gmail.com
> <ma...@gmail.com> wrote:
>  >> Dave is right Emi. I have been working with other frameworks
> recently, and
>  >> what Struts/2 needs is a simple FlashScope that allows a request to
> last two
>  >> life-cycles. However, unless you were doing something OOTO, a request in
>  >> Struts/2 lasts for one reqest/response trip.
>  >>
>  >> Peace,
>  >> Scott
>  >>
>  >> On Tue, Jul 12, 2011 at 11:14 AM, Dave Newton<davelnewton@gmail.com
> <ma...@gmail.com>> wrote:
>  >>
>  >>> On Tue, Jul 12, 2011 at 12:05 PM, Emi Lu wrote:
>  >>>>> Because it's a redirect, and things in the request go away when
>  >>>>> there's a new request.
>  >>>> Not true for previous version.
>  >>>
>  >>> Previous version had a bug, then, because by default, anything
>  >>> relating to an action's instantiation should go away during a
>  >>> redirect--that's kind of the point of instantiating an
>  >>> action-per-request.
>  >>>
>  >>> Again, the only way this *should* be possible is by (incorrectly, IMO)
>  >>> using singleton actions (Bad Idea) or a scope intereptor (or
>  >>> equivalent). Are you using Spring?
>  >>>
>  >>> Please zip up a (maven-ized) minimal example showing the behavior;
>  >>> I'll change the S2 version to the two you mention and debug
>  >>> this--messages should *not* persist between requests.
>  >>>
>  >>> Dave
>  >>>
>  >>> ---------------------------------------------------------------------
>  >>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> <ma...@struts.apache.org>
>  >>> For additional commands, e-mail: user-help@struts.apache.org
> <ma...@struts.apache.org>
>  >>>
>  >>>
>  >>
>  >
>  >
>  > --
>  > Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
>  > emilu@encs.concordia.ca <ma...@encs.concordia.ca> +1 514
> 848-2424 x5884
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> <ma...@struts.apache.org>
>  > For additional commands, e-mail: user-help@struts.apache.org
> <ma...@struts.apache.org>
>  >


-- 
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
emilu@encs.concordia.ca        +1 514 848-2424 x5884

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


Re: addActionMessage does not show message after redirect (struts2.2.3)

Posted by Dave Newton <da...@gmail.com>.
Do you understand /why/ we're saying it? IMO it'd be beneficial to
understand why you're seeing a "change" in behavior.

Dave
 On Jul 12, 2011 1:17 PM, "Emi Lu" <em...@encs.concordia.ca> wrote:
> Thank you for all inputs! All right, I will have to change my codes.
>
> Emi
>
>
> On 07/12/2011 12:57 PM, stanlick@gmail.com wrote:
>> Dave is right Emi. I have been working with other frameworks recently,
and
>> what Struts/2 needs is a simple FlashScope that allows a request to last
two
>> life-cycles. However, unless you were doing something OOTO, a request in
>> Struts/2 lasts for one reqest/response trip.
>>
>> Peace,
>> Scott
>>
>> On Tue, Jul 12, 2011 at 11:14 AM, Dave Newton<da...@gmail.com>
wrote:
>>
>>> On Tue, Jul 12, 2011 at 12:05 PM, Emi Lu wrote:
>>>>> Because it's a redirect, and things in the request go away when
>>>>> there's a new request.
>>>> Not true for previous version.
>>>
>>> Previous version had a bug, then, because by default, anything
>>> relating to an action's instantiation should go away during a
>>> redirect--that's kind of the point of instantiating an
>>> action-per-request.
>>>
>>> Again, the only way this *should* be possible is by (incorrectly, IMO)
>>> using singleton actions (Bad Idea) or a scope intereptor (or
>>> equivalent). Are you using Spring?
>>>
>>> Please zip up a (maven-ized) minimal example showing the behavior;
>>> I'll change the S2 version to the two you mention and debug
>>> this--messages should *not* persist between requests.
>>>
>>> Dave
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>
>
> --
> Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
> emilu@encs.concordia.ca +1 514 848-2424 x5884
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

Re: addActionMessage does not show message after redirect (struts2.2.3)

Posted by Emi Lu <em...@encs.concordia.ca>.
Thank you for all inputs! All right, I will have to change my codes.

Emi


On 07/12/2011 12:57 PM, stanlick@gmail.com wrote:
> Dave is right Emi.  I have been working with other frameworks recently, and
> what Struts/2 needs is a simple FlashScope that allows a request to last two
> life-cycles.  However, unless you were doing something OOTO, a request in
> Struts/2 lasts for one reqest/response trip.
>
> Peace,
> Scott
>
> On Tue, Jul 12, 2011 at 11:14 AM, Dave Newton<da...@gmail.com>  wrote:
>
>> On Tue, Jul 12, 2011 at 12:05 PM, Emi Lu wrote:
>>>> Because it's a redirect, and things in the request go away when
>>>> there's a new request.
>>> Not true for previous version.
>>
>> Previous version had a bug, then, because by default, anything
>> relating to an action's instantiation should go away during a
>> redirect--that's kind of the point of instantiating an
>> action-per-request.
>>
>> Again, the only way this *should* be possible is by (incorrectly, IMO)
>> using singleton actions (Bad Idea) or a scope intereptor (or
>> equivalent). Are you using Spring?
>>
>> Please zip up a (maven-ized) minimal example showing the behavior;
>> I'll change the S2 version to the two you mention and debug
>> this--messages should *not* persist between requests.
>>
>> Dave
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>


-- 
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
emilu@encs.concordia.ca        +1 514 848-2424 x5884

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


Re: addActionMessage does not show message after redirect (struts2.2.3)

Posted by st...@gmail.com.
Dave is right Emi.  I have been working with other frameworks recently, and
what Struts/2 needs is a simple FlashScope that allows a request to last two
life-cycles.  However, unless you were doing something OOTO, a request in
Struts/2 lasts for one reqest/response trip.

Peace,
Scott

On Tue, Jul 12, 2011 at 11:14 AM, Dave Newton <da...@gmail.com> wrote:

> On Tue, Jul 12, 2011 at 12:05 PM, Emi Lu wrote:
> >> Because it's a redirect, and things in the request go away when
> >> there's a new request.
> > Not true for previous version.
>
> Previous version had a bug, then, because by default, anything
> relating to an action's instantiation should go away during a
> redirect--that's kind of the point of instantiating an
> action-per-request.
>
> Again, the only way this *should* be possible is by (incorrectly, IMO)
> using singleton actions (Bad Idea) or a scope intereptor (or
> equivalent). Are you using Spring?
>
> Please zip up a (maven-ized) minimal example showing the behavior;
> I'll change the S2 version to the two you mention and debug
> this--messages should *not* persist between requests.
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: addActionMessage does not show message after redirect (struts2.2.3)

Posted by Dave Newton <da...@gmail.com>.
On Tue, Jul 12, 2011 at 12:05 PM, Emi Lu wrote:
>> Because it's a redirect, and things in the request go away when
>> there's a new request.
> Not true for previous version.

Previous version had a bug, then, because by default, anything
relating to an action's instantiation should go away during a
redirect--that's kind of the point of instantiating an
action-per-request.

Again, the only way this *should* be possible is by (incorrectly, IMO)
using singleton actions (Bad Idea) or a scope intereptor (or
equivalent). Are you using Spring?

Please zip up a (maven-ized) minimal example showing the behavior;
I'll change the S2 version to the two you mention and debug
this--messages should *not* persist between requests.

Dave

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


Re: addActionMessage does not show message after redirect (struts2.2.3)

Posted by Chris Pratt <th...@gmail.com>.
That is definitely not my experience.  As Dave said, the Action/Field
Errors/Messages have always been stored in the request and lost across a
redirect.  There have been several interceptors that have been talked about
on this list to bridge that problem, but they are not on the stack by
default.
  (*Chris*)

On Tue, Jul 12, 2011 at 9:05 AM, Emi Lu <em...@encs.concordia.ca> wrote:

> Hi Dave,
>
>
>  Because it's a redirect, and things in the request go away when
>> there's a new request.
>>
>
> Not true for previous version.
>
> Previous version keeps the ActionMessage. Only ActionErrorMessage does not
> show.
>
> Only the new version does not show the message anymore after redirect, do
> you know why?
>
> Emib
>
>
>
>
>> On Tue, Jul 12, 2011 at 11:39 AM, Emi Lu<em...@encs.concordia.ca>  wrote:
>>
>>> Hello List,
>>>
>>> Struts2.2.3, it seems that addActionMessage does not show message after
>>> redirect.
>>>
>>> Someone knows why?
>>>
>>> Thank you,
>>> Emi
>>>
>>> ====================
>>> Action.java
>>> this.addActionMessage(this.**getText("UPDATE.SUCCESS"));
>>> return forward_str;
>>>
>>>
>>> <action name="*Action"  method="{1}" class="Action">
>>>  ....
>>>  <result name="forward_str" type="redirectAction">
>>>   <param name="actionName">Action2</**param>
>>>   <param name="namespace">/Action</**param>
>>>  </result>
>>> </action>
>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.**apache.org<us...@struts.apache.org>
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: user-unsubscribe@struts.**apache.org<us...@struts.apache.org>
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> --
> Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
> emilu@encs.concordia.ca        +1 514 848-2424 x5884
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: user-unsubscribe@struts.**apache.org<us...@struts.apache.org>
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: addActionMessage does not show message after redirect (struts2.2.3)

Posted by Emi Lu <em...@encs.concordia.ca>.
Hi Dave,

> Because it's a redirect, and things in the request go away when
> there's a new request.

Not true for previous version.

Previous version keeps the ActionMessage. Only ActionErrorMessage does 
not show.

Only the new version does not show the message anymore after redirect, 
do you know why?

Emi


>
> On Tue, Jul 12, 2011 at 11:39 AM, Emi Lu<em...@encs.concordia.ca>  wrote:
>> Hello List,
>>
>> Struts2.2.3, it seems that addActionMessage does not show message after
>> redirect.
>>
>> Someone knows why?
>>
>> Thank you,
>> Emi
>>
>> ====================
>> Action.java
>> this.addActionMessage(this.getText("UPDATE.SUCCESS"));
>> return forward_str;
>>
>>
>> <action name="*Action"  method="{1}" class="Action">
>>   ....
>>   <result name="forward_str" type="redirectAction">
>>    <param name="actionName">Action2</param>
>>    <param name="namespace">/Action</param>
>>   </result>
>> </action>
>>
>> ---------------------------------------------------------------------
>> 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
>


-- 
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
emilu@encs.concordia.ca        +1 514 848-2424 x5884

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


Re: addActionMessage does not show message after redirect (struts2.2.3)

Posted by Dave Newton <da...@gmail.com>.
Because it's a redirect, and things in the request go away when
there's a new request.

Dave

On Tue, Jul 12, 2011 at 11:39 AM, Emi Lu <em...@encs.concordia.ca> wrote:
> Hello List,
>
> Struts2.2.3, it seems that addActionMessage does not show message after
> redirect.
>
> Someone knows why?
>
> Thank you,
> Emi
>
> ====================
> Action.java
> this.addActionMessage(this.getText("UPDATE.SUCCESS"));
> return forward_str;
>
>
> <action name="*Action"  method="{1}" class="Action">
>  ....
>  <result name="forward_str" type="redirectAction">
>   <param name="actionName">Action2</param>
>   <param name="namespace">/Action</param>
>  </result>
> </action>
>
> ---------------------------------------------------------------------
> 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