问题
把一个项目 copy 到自己电脑上后,图片 javaweb 项目 各种红,报错, jsp 页面也报错。
Description Resource Path Location Type
The type javax.servlet.http.HttpServletRequest cannot be resolved. It is indirectly referenced from required .class files ItemController.java /spring-mybatis2/src/com/itheima/springmvc/controller line 1 Java Problem
Description Resource Path Location Type
The project was not built since its build path is incomplete. Cannot find the class file for javax.servlet.http.HttpServletRequest. Fix the build path then try building this project spring-mybatis2 Unknown Java Problem

原因
tomcat 相关依赖包 没有引入项目
解决方案
项目 -【右击】-> build path [–> configure build path] --> Libraries
看看是不是少了一个 tomcat 模块。要是缺少的话, 点击 【Add Library…】 并选择 【Server Runtime】


点击 finished 即可。
此时可以看见 目录结构中 多了 tomcat 依赖库, 然后项目也不报错了。

本文详细介绍了在将项目复制到本地后遇到的JavaWeb项目图片加载失败、JSP页面报错等问题的原因及解决方案。主要原因是Tomcat相关依赖包未正确引入项目,通过配置项目构建路径并添加Tomcat模块,可以有效解决这些问题。
1589

被折叠的 条评论
为什么被折叠?



