Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

[S2] Session scoped action errors/messages

Laurie Harper

2007-02-26


Struts1 allows action errors and messages to be saved into the session
for display after a redirect, and supports automatically clearing the
messages once they've been displayed. Does Struts2 have any support for
achieving the same thing?

ValidationAware doesn't specify any scope-aware methods (nor would it
seem appropriate for it to do do). Is there some other interface I can
implement, or interceptor I can configure, to allow messages to cross a
redirect-boundary?

For example, consider the following action:

@Result(value="success.jsp", type=ServletActionRedirect.class)
public class MyAction extends ActionSupport {
 public String execute() {
  addActionMessage("operation succeeded");
  return SUCCESS;
 }
}

If nothing like this exists already, I'll implement an interceptor but I
don't want to be re-inventing any wheels ;=)

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.