国产探花免费观看_亚洲丰满少妇自慰呻吟_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://www.survivalescaperooms.com)



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 壤塘县| 台南县| 望江县| 新晃| 辽中县| 宁陕县| 灵台县| 淅川县| 高陵县| 青河县| 搜索| 长武县| 丹巴县| 奎屯市| 前郭尔| 兴安县| 乐至县| 碌曲县| 九寨沟县| 贡山| 大方县| 东兴市| 邢台县| 河池市| 邹平县| 江口县| 长丰县| 正蓝旗| 钟祥市| 建湖县| 都江堰市| 富平县| 格尔木市| 广元市| 海晏县| 扶余县| 甘洛县| 铁力市| 苏尼特右旗| 孟津县| 博兴县|