"Java EE Enterprise Application Combat Learning record" Requestlistener

Source: Internet
Author: User

1  PackageSanglp.servlet;2 3 Importjavax.servlet.*;4 ImportJavax.servlet.annotation.WebListener;5 Importjavax.servlet.http.HttpServletRequest;6 7 /**8 * Created by Administrator on 2016/10/5.9  */Ten @WebListener One  Public classRequestlistenerImplementsServletrequestlistener,servletrequestattributelistener { A  -     //the end of the user request, the method is triggered when initialized - @Override the      Public voidrequestinitialized (servletrequestevent servletrequestevent) { -HttpServletRequest request=(HttpServletRequest) servletrequestevent.getservletrequest (); -System.out.println ("Send To" +request.getrequesturi () + "request Initialized"); -     } +     //The method is triggered when the user requests the end and is destroyed - @Override +      Public voidrequestdestroyed (servletrequestevent servletrequestevent) { AHttpServletRequest request=(HttpServletRequest) servletrequestevent.getservletrequest (); atSystem.out.println ("Send To" +request.getrequesturi () + "request destroyed"); -  -     } -  - @Override -      Public voidattributeadded (servletrequestattributeevent servletrequestattributeevent) { inServletContext application=Servletrequestattributeevent.getservletcontext (); -         //get the added property name and property value toString name=servletrequestattributeevent.getname (); +Object value=Servletrequestattributeevent.getvalue (); -System.out.println (application+ "range added" +name+ "value for" +value+ "property"); the  *     } $ Panax Notoginseng @Override -      Public voidattributeremoved (servletrequestattributeevent servletrequestattributeevent) { theServletContext application=Servletrequestattributeevent.getservletcontext (); +         //get the added property name and property value AString name=servletrequestattributeevent.getname (); theObject value=Servletrequestattributeevent.getvalue (); +System.out.println (application+ ") has removed the attribute" +name+ "with the value" +value+ "); -     } $  $ @Override -      Public voidattributereplaced (servletrequestattributeevent servletrequestattributeevent) { -ServletContext application=Servletrequestattributeevent.getservletcontext (); the         //get the added property name and property value -String name=servletrequestattributeevent.getname ();WuyiObject value=Servletrequestattributeevent.getvalue (); theSystem.out.println (application+ "Scope" replaced the "+name+" value for the "+value+" property "); -     } Wu}

"Java EE Enterprise Application Combat Learning record" Requestlistener

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.