Hi,all
I've got a problem when I put my own interceptors in my app:
I write an interceptor to authenticate whether the user access the current
page or action has logged in.
I write the code in the following style(refer to the mailreader example):
--------------------------------------------------------------------
......
public String intercept(ActionInvocation actionInvocation) throws Exception
{
Map session = actionInvocation.getInvocationContext().getSession();
                User user = (User) session.get(Constants.USER_KEY);
                boolean isAuthenticated = (null != user);
                if (isAuthenticated) {
                        return actionInvocation.invoke();
                } else {
                        //how to add actionErrors here?
                        return Action.LOGIN;
                }
.....

--------------------------------------------------------------------
The question is that :how can I addActionErrors to the interceptor,so that
when the invalid action---namelly not logged in---was redirected to the
login page,some actionErrors messages like "You are not logged in" can
display.

I notice that I can put cite addActionErrors("You are not logged in"); in my
action class,however,I do NOT have any hint how to add action errors in my
interceptor.
Just or can't?

Any comment would be appreciated.
-- 
View this message in context: 
http://www.nabble.com/How-can-I-add-ActionErrors-when-do-the-interceptor%27s-intercept%28%29-method--tf4095868.html#a11646263
Sent from the Struts - User mailing list archive at Nabble.com.

Reply via email to