bloglistener.java
来自「是一个网站的博客系统」· Java 代码 · 共 34 行
JAVA
34 行
package com.opensource.blog.web.servlet;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import com.opensource.blog.comm.*;
public class BlogListener
extends HttpServlet implements ServletContextListener {
//Notification that the web module is ready to process requests
public void contextInitialized(ServletContextEvent sce) {
String rootpath = sce.getServletContext().getRealPath("/");
//System.out.println(sce.getServletContext().getServletContextName());
if (rootpath != null) {
rootpath = rootpath.replaceAll("\\\\", "/");
}
else {
rootpath = "/";
}
Constant.ROOTPATH = rootpath;
}
//Notification that the servlet context is about to be shut down
public void contextDestroyed(ServletContextEvent sce) {
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?