Ich denke, Ihr Problem besteht darin, einen Benutzer auf Anmeldeseite umleiten, wenn sie nicht angemeldet sind. Verwenden @before auf jedem actionBean ist keine gute Idee. Um dies zu erreichen, können Sie Ihren eigenen Interceptor erstellen, indem Sie SpringInterceptorSupport erweitern.
@Intercepts(LifecycleStage.ActionBeanResolution)
public class MyInterceptor extends SpringInterceptorSupport {
private static final List<Class<? extends ActionBean>> ALLOW = Arrays.asList(LoginActionBean.class, anyOtherActionBeanAllowedWithoutLogin.class);
@Override
@SuppressWarnings({ "rawtypes" })
public Resolution intercept(ExecutionContext execContext) throws Exception {
Resolution resolution = execContext.proceed();
ActionBean actionBean = execContext.getActionBean();
Class<? extends ActionBean> destinationclass = actionBean.getClass();
if (!ALLOW.contains(destinationclass) && !isSessionExist()) {
resolution = new RedirectResolution(LoginActionBean.class);
}
return resolution;
}
private boolean isSessionExist() {
String login = (String)context.getRequest().getSession().getAttribute("login");
return login != null;
}
}
Sie können natürlich auch eigene Abfangjäger schreiben: http://www.stripesframework.org/display/stripes/Intercept+Execution (es ist sehr einfach!) – Kdeveloper