![](/img/trans.png)
[英]IllegalArgumentException: Document base \.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps does not exist or is not a readable directory
[英]Access files inside workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\
我有一个spring web 项目,它基本上测试 webApp 并捕获页面的屏幕截图。 保存图像的路径如下所示:
"\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
\Demo\WEB-INF\Results\Test\1118015800\error\error_ST001_1.jpg"
我正在尝试在 JSP 页面上显示保存的图像,但到目前为止还没有成功。 我尝试了相对路径的不同组合,我也尝试给出绝对路径,但它不起作用。 我的图像标签看起来像这样
<img src="<c:url value="/WEB-INF/Results/Test/1118015800/error/error_ST001_1.jpg" />" />
有没有人对显示图像有任何想法? 可能是因为文件存储在 Eclipse 工作区的 .metadata 文件夹中,我无法显示任何图像?
这是因为WEB-INF
目录比较特殊。 Web 容器不会从该位置提供文件 - 该行为在 Servlet 规范中定义。
您可以创建一个 servlet 来接受来自客户端的请求、加载图像(例如使用getResourceAsStream()
)并将它们流式传输回来,或者将图像移动到 Web 应用程序层次结构中的不同位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.