javax.servlet.* 无法解析为类型
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24456446/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
javax.servlet.* cannot be resolved to a type
提问by Chinmaya B
I am running ubuntu 14.04 and eclipse Kepler (with java ee modules preloaded) , I am developing Dynamic Web App for first time, it always says javax.servlet.xyz cannot be resolved to a type please help I am including a screen snapshot for my error page!
我正在运行 ubuntu 14.04 和 eclipse Kepler(预加载了 java ee 模块),我是第一次开发动态 Web 应用程序,它总是说 javax.servlet.xyz 无法解析为类型,请帮助我为我的屏幕截图错误页面!
采纳答案by Mandar Pandit
Only two things are required in Eclipse for this:
为此,在 Eclipse 中只需要两件事:
One
一
In Eclipse, Window -> Preferences -> Server -> Runtime Environment
Specify your Web Server or Application Server path, by adding a "New Server Runtime Environment".
在 Eclipse 中,Window -> Preferences -> Server -> Runtime Environment
通过添加“New Server Runtime Environment”指定您的 Web 服务器或应用程序服务器路径。
Update
更新
Initially, there are only few Server Runtime Environments available with Eclipse like:
最初,Eclipse 中只有少数服务器运行时环境可用,例如:
- Apache
- Basic
- ObjectWeb
- 阿帕奇
- 基本的
- 对象网
On an additional note, you can add more Server Adapters using the link Download additional server adapters
in Server Runtime Environmentsdialog screen.
在附加的注释,你可以使用链接添加更多的服务器适配器Download additional server adapters
在服务器运行时环境的对话屏幕。
Two
二
In Project Properties (Right Click on Project -> Properties), in Java Build Path, add Library "Server Runtime"
.
On adding Server Runtime to Project Library will add servlet-api.jar
and jsp-api.jar
jars to project dependencies.
在 Project Properties 中(右键单击 Project -> Properties),在 Java Build Path 中,添加 Library "Server Runtime"
。
在添加服务器运行时到项目库将增加servlet-api.jar
和jsp-api.jar
罐子到项目的依赖。