내 응용 프로그램은 Struts2를 사용하여 개발되었으며 사용자가 세션 속성을 기반으로 로그온했는지 여부에 따라 유효성을 검사하는 인터셉터가 있습니다. 이제 세션이 시간 초과되고 사용자가 다시 로그인을 시도한다고 말할 수 있습니다. 로그인이 성공하면 어떻게하면 다시 로그인 사용자를 처리하고 사용자가 작업중인 마지막 페이지로 돌아갈 수 있습니까? page3.jsp라고 말하면 되나요?struts2 세션 시간 제한 마지막 방문 페이지로 다시 연결
loginInterceptor는
public class LoginInterceptor extends AbstractInterceptor {
@Override
public String intercept(final ActionInvocation invocation) throws Exception {
Map<String, Object> session = ActionContext.getContext().getSession();
String userLoggedin = (String) session.get("userLoggedin ");
Object action = invocation.getAction();
// user is not logged in yet
if(userLoggedin == null){
// public pages that dont require login
if (action instanceof LoginNotRequired) {
return invocation.invoke();
}
// Pages that require the user to be logged in - user not logged in yet
if (!(action instanceof LoginAction)) {
return "loginRedirect";
}
}
// user is logged in
if (userLoggedin.equals("true")) {
return invocation.invoke();
}
return invocation.invoke();
}
}
struts.xml 정의
당신은 세션 제거를 통해 정보를 유지해야 할 것<interceptors>
<interceptor name="login" class="com.mypackage.LoginInterceptor">
</interceptor>
<interceptor-stack name="myStack">
<interceptor-ref name="login"></interceptor-ref>
<interceptor-ref name="defaultStack"></interceptor-ref>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="myStack"></default-interceptor-ref>
<global-results>
<result name="loginRedirect" type="redirect">/index.jsp</result>
</global-results>
이 인터셉터가 어떻게 작동하는지 알려주시겠습니까 ?? 현재 사용자의 페이지 정보를 얻으려면 어떻게해야합니까? 어떻게 내가 5 hrs 후 appications 범위 에서이 userid -> lastpage지도를 삭제 말해 줄까 ?? – rr87