Java SSM整合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: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 "> <!-- <!–配置权限拦截器–> <mvc:interceptors> <mvc:interceptor> <!–配置对哪些资源执行拦截操作–> <mvc:mapping path="/**"/> <!–配置哪些资源排除拦截操作–> <!– <mvc:exclude-mapping path="/"/>:表示允许/通过 ==> 访问/的时候会自动找到index 因为:<mvc:view-controller path="/" view-name="index"></mvc:view-controller> <mvc:exclude-mapping path="/login"/>:表示允许/login通过==> 当单击index.html中的提交按钮时就会访问ManagerController类中的/login进行登录判断 –> <mvc:exclude-mapping path="/"/> <mvc:exclude-mapping path="/login"/> <mvc:exclude-mapping path="/static"/> <bean class="com.hsx.interceptor.LoginInterceptor"/> </mvc:interceptor> </mvc:interceptors>--> <!--配置包扫描:只扫描controller--> <context:component-scan base-package="com.learn.controller" use-default-filters="false"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/> </context:component-scan> <!--配置Thymeleaf视图解析器--> <!--<bean id="viewResolver" class="org.thymeleaf.spring5.view.ThymeleafViewResolver"> <property name="order" value="1"/> <property name="characterEncoding" value="UTF-8"/> <property name="templateEngine"> <bean class="org.thymeleaf.spring5.SpringTemplateEngine"> <property name="templateResolver"> <bean class="org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver"> <!– 视图前缀 –> <property name="prefix" value="/WEB-INF/templates/"/> <!– 视图后缀 –> <property name="suffix" value=".html"/> <property name="templateMode" value="HTML5"/> <property name="characterEncoding" value="UTF-8"/> </bean> </property> </bean> </property> </bean>--> <!--不配置此物无法访问静态资源--> <!--<mvc:view-controller path="/" view-name="index"></mvc:view-controller> <mvc:view-controller path="/list" view-name="list"></mvc:view-controller>--> <!--两个标准配置 --> <!-- 将springmvc不能处理的请求交给tomcat --> <mvc:default-servlet-handler/> <!-- 能支持springmvc更高级的一些功能,JSR303校验,快捷的ajax...映射动态请求 --> <mvc:annotation-driven/> </beans>
标签:xml,index,gt,Java,配置文件,--,视图,lt,ndash 来源: https://blog.csdn.net/xianai3513/article/details/122205139