直接关闭IE,释放Session

jsp:

<script language="javascript">

function destroySession(){
if((window.event.clientX<0)&&(window.event.clientY<0)){
newwindow=window.open("invalidateSession.do",null,"height=10,width=10");
newwindow.close();
}
}
</script>

<body onunload="destroySession()">
</body>

 

Action:

 

import javax.servlet.http.*;
import org.apache.struts.action.*;

public class invalidateSession extends Action{
 public ActionForward execute(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response) {
  HttpSession session=request.getSession(false);
  if(session!=null){
   System.out.println("Destroying Session");
   System.out.println("Session ID:"+session.getId());
   session.invalidate();
  }
 return null;
 }
}

没有更多推荐了,返回首页