有没有办法映射所有css资源,以便它们都是从SpringMVC的/ css文件夹中提供的?
防爆。 /login/sampleUser/ie.css
映射到/css/ie.css
我一直在尝试使用<mvc:resources mapping="/css/**" location="/css/" >
,但似乎没有用。
由于
答案 0 :(得分:2)
您可以使用Tuckey Url Rewrite Filter。在那里,您可以定义更复杂的重写规则。
<!-- I do not know if this fiter works (correctly), but it should
demonstrate how it works-->
<rule>
<!-- redirect everything that ends with .css
to resources, with same file name -->
<from>/(.*)/$.css</from>
<to type="redirect">/resouces/$1</to>
</rule>