📄 bloglistener.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -