去的时候就session timeout了,就异常报错了啊.
哎,看来只有抓异常来判断了..........

解决方案 »

  1.   

    session.isvalid()
    或者,取它的某个标志性的属性,取到NULL,就是失效了。
      

  2.   

    use request.getSession(false);
    if it returns null, there is no valid session
      

  3.   

    isvalid()有这个方法吗?
    to:Diesang 不错的方法.
    public HttpSession getSession(boolean create)Returns the current HttpSession associated with this request or, if if there is no current session and create is true, returns a new session. 
    If create is false and the request has no valid HttpSession, this method returns 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    null. 
    ~~~`
    To make sure the session is properly maintained, you must call this method before the response is committed.