Hi Adam,

I have created a ticket in Jira:
https://issues.apache.org/struts/browse/WW-2252

and attached a first version with my changes to the interceptor. 

I was thinking of also adding functionality similar to your requirements. I
totally agree that it would be nice if Struts 2 handled the
storing/retrieving of messages automagically - However I am not sure if this
can be done easily (I ran into some issues when dealing with forwards
between 2 actions)

I think what certainly would work is something like an autoRetrieve mode.
That way I would have to use @StoreMessages, only. Maybe even better would
be to have a method:

addActionMessage(String aMessage, boolean storeToSession) ;

That way messages can be added selectively...and the circle closes and we
restored the functionality of Struts 1 :-)

Cheers,

Gunnar



Adam Hardy-3 wrote:
> 
> Hi Gunnar
> 
> I wanted it to work without needing to tell it when to do its stuff.
> 
> I based my changes on the requirement for displaying success messages
> after a 
> redirect.
> 
> The messages / errors only need to survive until the next request. So
> anything 
> in the request I put into the session (in the after method) and in the
> before 
> method, anything in the session, I remove and put into the request. Just
> like 
> you say, works like a charm.
> 
> Adam
> 
> Gunnar Hillert on 12/10/07 05:15, wrote:
>> Hi Adam,
>> 
>> Thanks for your comments. Yes, I looked at the sources for the
>> MessageStoreInterceptor and indeed it looks quite simple. I played around
>> with it tonight and I made the inteceptor annotations-aware. 
>> 
>> I have added 2 method-level annotations: @StoreMessages and
>> @RetrieveMessages
>> This works like a charm :-)  This will work for me as a start. I still
>> need
>> to clean it up a bit....and can then  send you what I have. 
>> 
>> What changes did you you?
>> 
>> Regards,
>> 
>> Gunnar
>> 
>> 
>> Adam Hardy-3 wrote:
>>> Gunnar,
>>>
>>> the message store interceptor is quite lean. I have copied it and
>>> written
>>> my own 
>>> version to give me the functionality I needed. Now with your comments,
>>> it
>>> seems 
>>> like a prime target for further development by S2 to beef it up a bit to
>>> provide 
>>> more options.
>>>
>>> Maybe we could put in a patch with both our changes, if you implemented
>>> what you 
>>> need?
>>>
>>> Regards
>>> Adam
>>>
>>>
>>>
>>> Gunnar Hillert on 11/10/07 04:56, wrote:
>>>> Hi,
>>>>
>>>> Is there a way to configure the message store interceptor via
>>>> annotations?
>>>>
>>>> I started experimenting with the smarturls plugin for Struts 2
>>>> (http://code.google.com/p/smarturls-s2/) in order to get rid of my XML
>>>> configuration but noticed that I need the message store interceptor to
>>>> have
>>>> success message to survive redirects. 
>>>>
>>>> Well, it looks like the the message store interceptor does not have
>>>> annotations support (bummer). But maybe is there another way to solve
>>>> this
>>>> issue? 
>>>>
>>>> Thanks a lot!
>>>>
>>>> Gunnar Hillert
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Configure-Message-Store-Interceptor-via-Annotations-tf4604956.html#a13195995
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to