ServletRequest的getServletContext方法是Servlet3.0添加的,这个可以看一下官方文档

http://docs.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html#getServletContext()

而Tomcat6只支持到Servlet2.5看它的官方文档可以知道,要用J2EE6的话得换成Tomcat7

http://tomcat.apache.org/tomcat-6.0-doc/index.html

旧版本需要先用request拿到HttpSession或者通过Servlet自身拿到ServletConfig之后再获取ServletContext

相关文章:

  • 2021-05-24
  • 2022-03-01
  • 2022-12-23
  • 2021-09-19
  • 2021-09-28
  • 2022-03-08
  • 2021-11-20
猜你喜欢
  • 2022-12-23
  • 2021-11-18
  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-22
相关资源
相似解决方案