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、

相关文章:

  • 2021-07-17
  • 2022-01-01
  • 2021-10-27
  • 2022-12-23
猜你喜欢
  • 2021-08-04
  • 2022-01-02
  • 2021-07-02
  • 2021-06-06
  • 2021-10-12
相关资源
相似解决方案