基础知识不牢固啊,今天在使用request去跳转jsp页面时(因为要传递数据必须跳转),在遍历地址获取图片时一直获取不到,开始以为是web.xml中配置的拦截了,但是发现并不是,之后在F12的时候在才发现请求地址中多了个参数导致不能找到文件
上网百度才发现,servlet在进行跳转的时候如果controller层设置有路径的话会自动带上
目前我解决的办法是按照请求的路径来见文件夹
这里我用的是<c:foreach>标签进行遍历要到俩个maven坐标
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>