ServletContext getContextPath() [英] ServletContext getContextPath()

查看:194
本文介绍了ServletContext getContextPath()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我检查了包含在Netbeans项目下的Tomcat库的javadocs,并且在部署代码时效果很好,但是当我对Web项目进行干净构建时,在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?

推荐答案

我怀疑它不是您要构建的ServletContext版本,但它却是部署反对.根据版本2.5的文档 2.5中引入.因此,基本上将您要构建的servlet.jar更改为2.5,就可以了.

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.

这篇关于ServletContext getContextPath()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆