Arquivo de etiquetas: interceptor

Struts2 ActionMessages and redirect

Lets say you have an Action that lists some items. And you have another action that adds items.

If you add an Item you can either just show a “blank” with the “All ok with addition” or even smarter is to use the ListAction. But how do you give feedback to the user that the addition was ok? Simple you just addActionMessage(“Item added ok”); on the first action and the message will be rendered by the s:actionmessage in the jsp of the second. Right? Wrong!!
Struts will “eat” ActionMessages and ActionErrors between the first and second action. But Glindholm solved the problem with a simple Interceptor.