您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
16_ServletContext_获取
发布时间:2022-08-21 12:44:44编辑:雪饮阅读()
两种不同方式获取的ServletContext对象实际上是相同的,但是需要稍微忌惮下这是同一个web哈。
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ServletContext context1=request.getServletContext();
ServletContext context2=this.getServletContext();
System.out.println(context1==context2);
}
关键字词:ServletContext,获取