码迷,mamicode.com
首页 > 编程语言 > 详细

SpringMVC的注解方式

时间:2016-05-20 23:51:27      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:

mvc-servlet.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-4.2.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd">
    <!-- 启动SpringMVC的注解方式 -->
    <mvc:annotation-driven/>
    <!-- 扫描 -->
    <context:component-scan base-package="com.shxt"/>
    <!--第一种  -->
    <mvc:default-servlet-handler/>
    <!--第二种  -->
    <mvc:resources location="/resource/" mapping="/shxt/**"></mvc:resources>
    <!-- JSP的视图解析器 -->
    <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
        <property name="prefix" value="/WEB-INF/"/>
        <property name="suffix" value=".jsp"/>
    </bean>
</beans>

 

SpringMVC的注解方式

标签:

原文地址:http://www.cnblogs.com/lusid/p/5513755.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!