zoukankan      html  css  js  c++  java
  • SpringMVC使用静态资源

    1、Servlet配置如下:

    <?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:p="http://www.springframework.org/schema/p"
        xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="
            http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context-3.0.xsd
            http://www.springframework.org/schema/mvc
            http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
    
        <!-- 声明使用注解的风格 -->
        <context:annotation-config />
        <!-- 开启mvc注解 -->
        <mvc:annotation-driven />
        <!-- 静态资源(js/image)的访问 -->
        <mvc:resources location="/WEB-INF/res/img/" mapping="/img/**" />
        <mvc:resources location="/WEB-INF/res/css/" mapping="/css/**" />
        <mvc:resources location="/WEB-INF/res/js/" mapping="/js/**" />
    
        <context:component-scan base-package="nankang/controller" />
        <!-- 定义视图解析器 -->
        <bean
            class="org.springframework.web.servlet.view.InternalResourceViewResolver"
            p:viewClass="org.springframework.web.servlet.view.JstlView" p:prefix="/WEB-INF/page/"
            p:suffix=".jsp">
        </bean>
    
    </beans>

    2、

  • 相关阅读:
    静态库中的静态变量连接失败的解决
    (转)Virtual PC 2007虚拟网络设置
    (zt)iPhone Developer注册
    (zt)正则表达式30分钟入门教程
    (zt)Flex SDK 3.2和Flex Builder 3.0.2升级
    (转)完成端口之性能优化
    (摘)法拉利年代型号
    安装windows下的NDS开发环境
    [C#]小问题
    javascript "未结束字符串"
  • 原文地址:https://www.cnblogs.com/sshoub/p/4371447.html
Copyright © 2011-2022 走看看