zoukankan      html  css  js  c++  java
  • spring mvc 资源包的映射

    在springmvc.xml中进行设置;

    <?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.1.xsd
            http://www.springframework.org/schema/beans 
            http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
            http://www.springframework.org/schema/context 
            http://www.springframework.org/schema/context/spring-context-4.1.xsd">
        ...
        <!-- 进行资源的映射 -->
        <mvc:resources location="/resources/" mapping="/resources/**" />
        ...
    
    
    </beans>

     在web.xml中的设置;

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://java.sun.com/xml/ns/javaee"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
        id="WebApp_ID" version="3.0">
        <servlet>
            <servlet-name>user</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/WEB-INF/springmvc.xml</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>user</servlet-name>
            <url-pattern>/</url-pattern>
        </servlet-mapping>
    
        <!-- 解决工程编码过滤器 -->
        <filter>
            <filter-name>characterEncodingFilter</filter-name>
            <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
            <init-param>
                <param-name>encoding</param-name>
                <param-value>UTF-8</param-value>
            </init-param>
        </filter>
    
        <filter-mapping>
            <filter-name>characterEncodingFilter</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    </web-app>
  • 相关阅读:
    本地图文直接复制到文本编辑器中
    本地图文直接复制到富文本编辑器中
    本地多张图片直接复制到富文本编辑器中
    能粘贴Word 内容(含图片)的富文本编辑器
    能粘贴Word 内容(含图片)的文本编辑器
    js+WebUploader分片上传大文件
    js+web分片上传大文件
    js+前端分片上传大文件
    Java学习——方法中传递参数分简单类型与复杂类型(引用类型)
    线段树练习
  • 原文地址:https://www.cnblogs.com/stono/p/4514024.html
Copyright © 2011-2022 走看看