📄 productserveletcontextlistener.java
字号:
package cart.listener;import cart.biz.ShowHomePageBiz;import javax.servlet.*;import javax.servlet.http.*;import java.io.*;import java.util.*;public class ProductServeletContextListener implements ServletContextListener{ //Notification that the web application is ready to process requests public void contextInitialized(ServletContextEvent sce) { ShowHomePageBiz homePage=new ShowHomePageBiz(); Collection collection=null; try{ collection=homePage.showProducts(); sce.getServletContext().setAttribute("products",collection); System.out.println("in listener init"); }catch(Exception e){ e.printStackTrace(); } } //Notification that the servlet context is about to be shut down public void contextDestroyed(ServletContextEvent sce) { throw new java.lang.UnsupportedOperationException("Method contextDestroyed() not yet implemented."); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -