黑马程序员
ServletContext–功能–域对象
传入的数据web共享
ServletContext–功能–获取文件服务器路径
ServletContext context2
= this.getServletContext();
String realPath
= context2
.getRealPath("/b.txt");
System
.out
.println(realPath
);
String c
= context2
.getRealPath("/WEB-INF/c.txt");
System
.out
.println(c
);
String a
= context2
.getRealPath("/WEB-INF/classes/a.txt");
System
.out
.println(a
);
转载请注明原文地址:https://blackberry.8miu.com/read-1227.html