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>

  • 相关阅读:
    古人诗词之王安石
    关于周期函数的命题
    Strum—Lioville问题
    计算反常积分
    【面积原理】计算级数和
    【洛谷P6046】纯粹容器
    【洛谷P3631】方格染色
    【牛客挑战赛48 E】速度即转发
    【CF103D】Time to Raid Cowavans
    【洛谷P4280】逆序对
  • 原文地址:https://www.cnblogs.com/kfsrex/p/11456014.html
Copyright © 2011-2022 走看看