打开eclipse——>help——>install New Software——>work with输入下列地址:(oxygen会自动匹配你的版本)
http://download.eclipse.org/releases/oxygen/
——>选中插件“Web,XML,Java EE and OSGi Enterprise Development”一直next直至完成



操作完以上步骤后,新建一个“Dynamic Web Project”项目后我一直会爆一个错,如下图:

显示我路径下没有javax.servlet.http.HttpServlet,于是乎我就再网上找了好多方法,于是(选中项目右击在Build Path——>Configure )Java Build Path中添加了一些库文件

Java Build Path——>Libaraies——>Add Libaraies——>Server Runtime——>选中你下载的tomcat的包——>finish完成导入


添加servlet.文件Java Build Path——>Libaraies——>Add External JARs...——>在下载的tomcat文件中lib目录下找到文件“servlet-api.jar”——>open——>finish


安装后的Java Build Path:

eclipse与tomcat的连接
选中控制拦的servers选中tomcat(可能没有tomcat文件,网上应该有教程,也忘了是不是手动添加)右击——>Add and Remove——>选中自己所建的项目——>点击“Add”——>finish



在项目中新建index.jsp文件
测试一下:

运行(右击Run As——>Run on Server):

(也可直接点击运行按钮)
测试结果

项目目录内容

以上内容是自己在安装web插件时出现的问题以及大概步骤,希望对和我遇见相同问题的你有帮助😁
网友评论