导入项目时报错:The import javax.servlet.xxxx cannot be resolved
如果eclipse已经把jar包都导入完了,那么出现这个错误的原因可能是这个项目没有绑定Tomcat。
- 右键项目 -> build path -> confugure build path
- 选择Libraries标签页,
- 如果有不需要的Tomcat,点击这个Tomcat,点击右边的remove按钮
- 点击右边的Add Librariy,选择Server Runtime -> next
- 选择自己需要的Tomcat服务器,点击finish。