SpringMVC配置静态资源访问
2014-09-20 16:11
519 查看
1、静态资源配置
<mvc:default-servlet-handler/>
2、完整配置
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> <context:component-scan base-package="com.nextgame.web" /> <!--mvc静态资源访问 --> <mvc:default-servlet-handler/> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix"> <value>/WEB-INF/views/</value> </property> <property name="suffix"> <value>.jsp</value> </property> </bean> </beans>
3、问题
the prefix "mvc" for element "mvc:default-servlet-handler" is not bound在xml的beans中添加
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"
4、静态资源存放位置
静态资源存放在工程中的webapp目录下,可自定义子目录。5、浏览器访问静态图片
相关文章推荐
- SpringMvc 框架静态资源访问配置
- 在springmvc中配置静态资源访问路径的时候,js出现无效原因
- springmvc访问静态资源的springmvc.xml配置
- SpringMVC 笔记——访问静态资源DispatcherServlet 配置问题
- springMVC处理静态资源——jquery文件配置正确访问不到404错误信息
- SpringMVC对静态资源文件的访问(配置)
- SpringMVC 配置静态资源的正常访问
- SpringMVC 多控制器,静态资源访问,配置文件位置更改
- springMVC配置静态资源访问的<mvc:resources>标签的使用
- springMvc配置静态资源访问
- 当配置 DispatcherServlet拦截“/”,SpringMVC访问静态资源的三种方式
- SpringMVC对静态资源文件的访问(配置)
- 如何配置SpringMVC能够访问静态资源
- SpringMVC REST 风格静态资源访问配置
- SpringMVC(10):配置静态资源访问(前端页面的元素显示)及实例
- SpringMVC在web.xml中配置DispatcherServlet拦截了静态资源访问
- springmvc访问静态资源的springmvc.xml配置
- SpringMVC对静态资源文件的访问(配置)
- SpringMVC REST 风格静态资源访问配置
- springMVC对静态资源的访问-配置