国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

演示SessionAttributeListener的使用方法

2019-11-18 16:07:11
字體:
來源:轉載
供稿:網友
import javax.servlet.http.Httpsession;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;

public class SessionAttribListen implements HttpSessionAttributeListener {

  /** Creates new SessionAttribListen */
  public SessionAttribListen() {

    System.out.PRintln(getClass().getName());
  }

  public void attributeAdded(HttpSessionBindingEvent se) {

    HttpSession session = se.getSession();
    String id = session.getId();
    String name = se.getName();
    String value = (String) se.getValue();
    String source = se.getSource().getClass().getName();
    String message = new StringBuffer("Attribute bound to session in ")
        .append(source).append("/nThe attribute name: ").append(name)
        .append("/n").append("The attribute value:").append(value)
        .append("/n").append("The session ID: ").append(id).toString();
    System.out.println(message);
  }

  public void attributeRemoved(HttpSessionBindingEvent se) {

    HttpSession session = se.getSession();
    String id = session.getId();
    String name = se.getName();
    if (name == null)
      name = "Unknown";
    String value = (String) se.getValue();
    String source = se.getSource().getClass().getName();
    String message = new StringBuffer("Attribute unbound from session in ")
        .append(source).append("/nThe attribute name: ").append(name)
        .append("/n").append("The attribute value: ").append(value)
        .append("/n").append("The session ID: ").append(id).toString();
    System.out.println(message);
  }

  public void attributeReplaced(HttpSessionBindingEvent se) {

    String source = se.getSource().getClass().getName();
    String message = new StringBuffer("Attribute replaced in session  ")
        .append(source).toString();
    System.out.println(message);
  }
}

(出處:http://m.survivalescaperooms.com)



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 郑州市| 宾川县| 象州县| 武安市| 昭觉县| 汉寿县| 牡丹江市| 会宁县| 南乐县| 仲巴县| 达日县| 呼玛县| 平昌县| 磐石市| 定边县| 绥阳县| 公主岭市| 康马县| 贵南县| 仁化县| 会泽县| 朝阳市| 美姑县| 安义县| 万州区| 辽源市| 天峻县| 义马市| 四川省| 伊通| 沁阳市| 巴东县| 舞钢市| 桂阳县| 定远县| 九江市| 南阳市| 安阳县| 临泽县| 滨州市| 平潭县|