jsp中:request.getContextPath()
servlet、action中:
HttpSession session = request.getSession();
ServletContext application = session.getServletContext();
String serverRealPath = application.getRealPath("/") ;
File f = new File(getClass().getResource("/").getPath());
f = new File(f.getPath().replace("%20"," ") + "/databasePool.conf");
%20代表空格!
就是\啊