标签:variable jar包下载 view 注解 release bean refresh ping osi
本篇文章仅供参考,大家一起进步!
选择自己适用的版本
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.1.13.RELEASE</version>
</dependency>
?
<?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: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">
?
<!-- 开启注解 -->
<mvc:annotation-driven />
?
<!-- 让扫描spring扫描这个包下所有的类,让标注spring注解的类生效 -->
<context:component-scan base-package="top.qinh.spring.controller"></context:component-scan>
?
<!-- 视图解析器 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/views/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
?
<!-- <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
<property name="messageConverters">
<list >
<ref bean="mappingJacksonHttpMessageConverter" />
</list>
</property>
</bean>
<bean id="mappingJacksonHttpMessageConverter"
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
</list>
</property>
</bean>-->
?
?
</beans>
<servlet>
<servlet-name>spring-mvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!-- 指定路径 -->
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-mvc.xml</param-value>
</init-param>
</servlet>
?
<servlet-mapping>
<servlet-name>spring-mvc</servlet-name>
<url-pattern>/</url-pattern> //拦截所有请求
</servlet-mapping>
package top.qinh.spring.controller;
?
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
?
import java.lang.annotation.Annotation;
?
在webapp下 创建一个views 文件,在控制器创建方法返回jps文件名
<%--
Created by IntelliJ IDEA.
User: FDZX
Date: 2020/6/10
Time: 15:34
To change this template use File | Settings | File Templates.
--%>
<%
<%--
Created by IntelliJ IDEA.
User: FDZX
Date: 2020/6/10
Time: 15:34
To change this template use File | Settings | File Templates.
--%>
<%
配置Tomcat Server
本片文章仅供参考,记录了黄国才老师课上讲的springmvc快速入门步骤。看得懂的扣1,看不懂的扣眼珠子
标签:variable jar包下载 view 注解 release bean refresh ping osi
原文地址:https://www.cnblogs.com/qin-h/p/13086404.html