getServletContext()这个方法在Servlet 3.0规范里才有,要tomcat7才行。
如果使用的tomact6.0就会报这个错,必须增加一个extended Servlet,方法如下:
File->Properties -> Java Build Path -> Libraries -> Add Library -> Server Runtime
本文介绍了如何解决在Servlet 3.0规范下使用getServletContext()方法时遇到的问题,特别是当运行环境为Tomcat 6.0时出现的错误。文中提供了一个通过添加extendedServlet的方法来解决该问题的步骤。
getServletContext()这个方法在Servlet 3.0规范里才有,要tomcat7才行。
如果使用的tomact6.0就会报这个错,必须增加一个extended Servlet,方法如下:
File->Properties -> Java Build Path -> Libraries -> Add Library -> Server Runtime
1022
756
8285

被折叠的 条评论
为什么被折叠?