One idea I have:
1. Create an interface called RedirectAware
2. Have the actions which need the redirectURL implement RedirectAware
3. Inject the redirectURL into Actions that are RedirectAware from the
interceptor
On Apr 6, 2009, at 4:17 AM, 白鹏 wrote:
hey,guys, the code follows,
public class LoginInterceptor extends AbstractInterceptor {
private String* redirectUrl*;
public String getRedirectUrl() {
return redirectUrl;
}
public void setRedirectUrl(String redirectUrl) {
this.redirectUrl = redirectUrl;
}
@Override
public String intercept(ActionInvocation arg0) throws Exception {
System.out.println("Come into the
LoginInterceptor#intercept()");
ActionContext ctx = arg0.getInvocationContext();
User user = (User) ctx.getSession().get("user");
if(user!= null){
return arg0.invoke();
}
ctx.put("tip", "请先登录系统:)");
Map params = ActionContext.getContext().getParameters();
*redirectUrl* = "*buildSendReq.action*
?productID=11&productTitle=Games+Explorer";
System.out.println("RedirectUrl="+redirectUrl);
System.out.println("Intercept() ok!");
* return Action.LOGIN; // Login.action , I want to pass the
redirectUrl to the Login.action. How to do ???*
}
}
======
Terry Gardner
terry.gard...@sun.com
"Vulcans never bluff." -- Spock
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org