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>

  • 相关阅读:
    Java中遍历Set集合的方法
    分布式RPC框架Apache Dubbo
    CSS:页面美化和布局控制
    JavaScript实例
    Codeforces Round #604 题解
    洛谷P1533 可怜的狗狗题解
    Educational Codeforces Round 81 题解
    P1494 [国家集训队]小Z的袜子 题解
    洛谷P1283 平板涂色题解
    洛谷P1220 关路灯题解
  • 原文地址:https://www.cnblogs.com/kfsrex/p/11456014.html
Copyright © 2011-2022 走看看