且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

javax.servlet。*无法解析为某个类型

更新时间:2023-12-04 14:40:58

Eclipse中只需要两件事情:

Only two things are required in Eclipse for this:

一个

在Eclipse中,窗口 - >首选项 - >服务器 - >运行时环境

指定您的Web服务器或应用程序服务器路径,通过添加新服务器运行时环境。

In Eclipse, Window -> Preferences -> Server -> Runtime Environment
Specify your Web Server or Application Server path, by adding a "New Server Runtime Environment".

更新

最初,Eclipse提供的服务器运行时环境很少,如:

Initially, there are only few Server Runtime Environments available with Eclipse like:


  1. Apache

  2. 基本

  3. ObjectWeb

另外请注意,您可以添加更多服务器适配器使用链接 服务器运行时环境对话框屏幕中下载其他服务器适配器

On an additional note, you can add more Server Adapters using the link Download additional server adapters in Server Runtime Environments dialog screen.

两个

在项目属性中(右键单击项目 - >属性),在Java Build Path中添加库服务器运行时
将服务器运行时添加到项目库时,将添加 servlet-api.jar jsp-api.jar jars to project dependencies。

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.