ServletContext
2020-11-17 19:08
views:
383
source:
在线打字小编
ServletContext对象: 1.概念:代表了整个web应用,可以和程序的容器(服务器)通信
。 2.获取: 1.通过request对象获取
request.getServletContext();
2.通过HttpServlet获取 this.getServ
letContext(); 3.功能: 1.获取MIME类型;
*MIME类型:在互联网通信过程中定义了一种文件数据类型。
*格式: 大类型/小类型 text/html image/jpeg *获
取:String getMimeType(String file) 2.域对象:
共享数据 1.setAttribute(String name,Obj
ect value) 2.getAttribute(String nam
e) 3.removeAttribute(String name)
*ServletContext对象范围:所用用户所有请求的数据
3.获取文件的真实(服务器)路径
Disclaimer: The above articles are added by users themselves and are only for typing and communication purposes. They do not represent the views of this website, and this website does not assume any legal responsibility. This statement is hereby made! If there is any infringement of your rights, please contact us promptly to delete it.