JAVA判断session是否连接

来源:互联网 发布:java微商城系统源码 编辑:程序博客网 时间:2024/05/21 22:02

String pid = "";

try{
  if(request.getSession(false)==null){
   response.sendRedirect("./../error_session.jsp");
    }
   
   pid  = (String)session.getAttribute("personid");

 if(pid == null){
 response.sendRedirect("../../error_session.jsp");
 } 
  } catch (Exception e) {
 e.printStackTrace();
  }