ServletContext getContextPath()

I checked the javadocs of the Tomcat library I have included under my Netbeans project, and when I deploy the code works fine, but when I do a clean-build of my web project I get a "cannot find symbol" on the getContextPath() method of the ServletContext interface

It's driving me completely insane because in order to run my tests and so on I have to first deploy, then test, if I clean and build, or clean and run tests I get this error...

Anyone have any clue what could be causing this issue? Is there a library I have to update or something?


I suspect it's not in the version of ServletContext you're building against, but it is in the version you're deploying against. According to the docs of version 2.5 it was introduced in 2.5. So basically change the servlet.jar you're building against to be the 2.5 one, and it should be fine.

链接地址: http://www.djcxy.com/p/67806.html

上一篇: 我如何在没有用户交互的情况下运行servlet

下一篇: ServletContext getContextPath()