1
我想用<mvc:resource/>
如<mvc:resources mapping="/images/**" location="/images/" />
<mvc:resources mapping="/resources/**" location="/resources/" />
在context-mvc.groovy
,我不知道該怎麼write.help我〜如何使用<MVC:資源/>在Groovy
import org.springframework.web.servlet.view.InternalResourceViewResolver
beans {
xmlns context: "http://www.springframework.org/schema/context"
context."component-scan"("base-package" : "com.oberon.fm")
viewResolver(InternalResourceViewResolver) {
prefix = "/pages/"
suffix = ".jsp"
}
}
謝謝你回答我的問題,我是春天的學習者,有時我覺得很難,感謝這些熱心的人,尤其是身邊,我還有一個問題,我的DipatcherServlet是「/」,然後當我usemvc .resources(mapping:「/ images/**」,location:「/ images /」),我的viewResolver不起作用 –
yang
2015-04-03 01:59:40
import org.springframework.web.servlet.view.InternalResourceViewResolver beans { \t xmlns([context :「http://www.springframework.org/schema/context」, \t mvc:「http://www.springframework.org/schema/mvc」]) \t mvc.resources(mapping: 「/ images/**」,位置:「/ images /」) \t mvc.resources(mapping:「/ css/**」,location:「/ css /」) \t context「component-scan」( 「基本封裝」: 「com.oberon.fm」) \t視圖解析器(的InternalResourceViewResolver){ \t \t前綴= 「/頁/」 \t \t後綴= 「.JSP」 \t} } – yang 2015-04-03 02:08:31