Httpsessionactivationlistener Interface Learning Notes

Source: Internet
Author: User

JavaBean objects that implement the Httpsessionactivationlistener interface can perceive their own activated and passivated events
The Web server calls the following method Sessionwillpassivate (Httpsessionbindingevent Event) method when the object bound to the HttpSession object is going to be passivated with the HttpSession object:
When the object bound to the HttpSession object is to be activated with the HttpSession object, the Web server calls the object's void Sessiondidactive (Httpsessionbindingevent event) method

<Manager className="org.apache.catalina.session.PersistentManager" maxIdleSwap="1"><Store className="org.apache.catalina.session.FileStore" directory="itcast"/></Manager></Context>注意:/META-INF/context.xml
package cn.vote.domain;import javax.servlet.http.HttpSessionActivationListener;import javax.servlet.http.HttpSessionEvent;/** JavaBean对象,感知自已何时被钝化,何时被激活,由Web容器决定 */public class Student implements HttpSessionActivationListener {    private String username;    public Student() {    }    public String getUsername() {        return username;    }    public void setUsername(String username) {        this.username = username;    }    public void sessionDidActivate(HttpSessionEvent se) {    }    public void sessionWillPassivate(HttpSessionEvent se) {    }}

Httpsessionactivationlistener Interface Learning Notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.