该记录问题适用于在IDEA下部署了Tomcat,运行jsp等等形成web页面的场景。
部署文件后生成target文件,但导入图片后target文件没有自动再导入
- 首先点开项目右侧的maven
- 点开与项目名同名的文件
- 点开 生命周期 选项
- 选择 clean,点击它的作用是将其之前生成的target删除
- 等待删除完成
- 选择 install,它会让target文件重新导入进去。
如果你是在webapp下导入了一个文件包,下面包含着图片,在上次没有导入的话,这次导入后你可以在下图中的文件里面查看下查看
部署按钮帮助打开Tomcat服务器,内容修改仅需要在已打开页面中进行页面的刷新即可
在文件中虽然print报红,但是运行不会出错
快捷 刷新部署状态
更改web项目自动加载的首页
在web-INF文件夹下的xml文件的<>标签内加入
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
本次项目更改后总的效果
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<welcome-file-list>
<welcome-file>loginForm.jsp</welcome-file>
</welcome-file-list>
</web-app>