如何在servlet刚启动时候获取服务器根目录?

public class InitServlet extends HttpServlet{

     public static String root;
    @Override
    public void init() throws ServletException {
         
       root = getServletContext().getRealPath("/");
     
    }

 

你可能感兴趣的:(servlet)