zoukankan      html  css  js  c++  java
  • springMVC的静态资源的释放

    当在web.xml中配置DispatcherServlet时的url-pattern的值为    /      这样会拦截所有,静态资源不会放行。

    释放静态资源:在springMVC配置文件里添加<mvc:default-servlett-handler/>

    <?xml version="1.0" encoding="UTF-8"?>

    <beans xmlns="http://www.springframework.org/schema/beans"

           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

           xmlns:mvc="http://www.springframework.org/schema/mvc"

           xmlns:context="http://www.springframework.org/schema/context"

           xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd

                  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

                  http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd">

           <context:component-scan base-package="com.zhiyou100.kfs.controller"></context:component-scan>

           <mvc:annotation-driven/>

           <!-- 静态资源的释放 -->

           <mvc:default-servlet-handler/>

           <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">

                  <property name="prefix" value="/"></property>

                  <property name="suffix" value=".jsp"></property>

           </bean>

    </beans>

  • 相关阅读:
    为什么选择 Yeoman 及 Yeoman 的安装
    NPOI高效匯出Excel
    CentOS7 MongoDB安裝
    打印函数调用堆栈
    libevent源码分析:eventop
    libevent源码分析:time-test例子
    libevent源码分析:event_assign、event_new
    libevent源码分析:bufferevent
    lievent源码分析:evbuffer
    epoll实现压测工具
  • 原文地址:https://www.cnblogs.com/kfsrex/p/11456014.html
Copyright © 2011-2022 走看看