0

我为幼儿园的孩子创建了一个 scala -maven web 项目.. 但问题是当我从资源图像文件夹访问图像时,我没有显示图像但是当我用浏览器阅读页面时,它会显示图像.. 那么有没有从jboss运行时显示图像的解决方案

4

1 回答 1

0

在应用程序的 spring 配置上下文中(在我的情况下,它通常是 app-context.xml),您是否定义了资源映射?例如,要从根“静态”文件夹中提供所有静态内容:

<!-- Handles HTTP GET requests by efficiently serving up static resources in the ${webappRoot}/static directory -->
<resources mapping="/static/**" location="/static/"/>

如果您还使用 spring security (security-context.xml),您需要确保已排除“静态”,类似于:

<security:http pattern="/static/**" security="none"/>

这应该允许您像这样解析应用程序中的图像:

http://www.somedomain.com/myApp/static/img/uglymug.jpg
http://www.somedomain.com/myApp/static/style/uglymug.css
http://www.somedomain.com/myApp/static/script/uglymug.js
于 2013-05-23T19:51:07.537 回答