欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

The method getServletContext is undefined for the type HttpServletRequest

程序员文章站 2022-07-15 13:22:50
...
ServletContext servletContext = request.getServletContext();

在myeclipse中,request中没有getServletContext()方法。出错原因,jar包版本不一致
可以改写为

ServletContext servletContext = getServletContext();
The method getServletContext is undefined for the type HttpServletRequest