zoukankan      html  css  js  c++  java
  • Spring配置静态目录

    mvc-dispatcher-servlet.xml文件

    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:mvc="http://www.springframework.org/schema/mvc"
           xsi:schemaLocation="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.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
        <!-- Load static resources -->
        <mvc:resources mapping="/javascript/**" location="/WEB-INF/pages/res/js/"/>
        <mvc:resources mapping="/styles/**" location="/WEB-INF/pages/res/css/"/>
        <mvc:resources mapping="/images/**" location="/WEB-INF/pages/res/images/"/>
        <!--If use Annotation must use it -->
        <mvc:annotation-driven/>
    
    
        <context:component-scan base-package="com.springapp.mvc"/>
        <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="prefix" value="/WEB-INF/pages/"/>
            <property name="suffix" value=".jsp"/>
        </bean>
    
    
    </beans>

    locatiom值为项目的资源路径,mapping值为项目的引用资源路径

    web.xml

    <web-app version="2.4"
        xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
        http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    
        <display-name>Spring MVC Application</display-name>
    
        <servlet>
            <servlet-name>mvc-dispatcher</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>mvc-dispatcher</servlet-name>
            <url-pattern>/</url-pattern>
        </servlet-mapping>
    </web-app>

  • 相关阅读:
    MS-data
    Lammps命令与in文件
    VMD建模得到模型
    VMD-合并模型与生成data文件
    VMD-水溶液中注入离子
    水分子模型
    1.MD相关概念
    Python7
    python6
    python5
  • 原文地址:https://www.cnblogs.com/Jsonlu/p/4845696.html
Copyright © 2011-2022 走看看