博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SpringMVC入门(springMVC的环境配置和入门程序以及简单的流程)
阅读量:3944 次
发布时间:2019-05-24

本文共 3195 字,大约阅读时间需要 10 分钟。

环境配置

首先创建一个maven-web项目

在这里插入图片描述
配置pom.xml

4.0.0
com.tianqicode
springMVC-day01
1.0-SNAPSHOT
war
UTF-8
1.8
1.8
5.0.2.RELEASE
org.springframework
spring-context
${spring.version}
org.springframework
spring-test
${spring.version}
org.springframework
spring-beans
${spring.version}
org.springframework
spring-webmvc
${spring.version}
org.springframework
spring-jdbc
${spring.version}
org.springframework
spring-aspects
${spring.version}
springMVC-day01
maven-clean-plugin
3.1.0
maven-resources-plugin
3.0.2
maven-compiler-plugin
3.8.0
maven-surefire-plugin
2.22.1
maven-war-plugin
3.2.2
maven-install-plugin
2.5.2
maven-deploy-plugin
2.8.2

准备一个controller

package com.tianqicode.controller;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;@Controllerpublic class Hello {
@RequestMapping(path = "/hello") public String helloSpringMVC() {
System.out.println("Hello,SpringMVC!"); return "hello"; }}

配置web.xml

Archetype Created Web Application
dispatcherServlet
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:springmvc.xml
1
dispatcherServlet
/

配置springmvc.xml

准备两个前端页面

<%@ page contentType="text/html;charset=UTF-8" language="java" %>入门程序

Hello World!

spring mvc 入门
<%--  Created by IntelliJ IDEA.  User: 10525  Date: 2020/2/10  Time: 12:35  To change this template use File | Settings | File Templates.--%><%@ page contentType="text/html;charset=UTF-8" language="java" %>    success    

Hello SpringMVC

简单的流程图

转载地址:http://ydowi.baihongyu.com/

你可能感兴趣的文章
一个简单的TabLayout的使用
查看>>
ReactNative使用Redux例子
查看>>
Promise的基本使用
查看>>
coursesa课程 Python 3 programming 统计文件有多少单词
查看>>
coursesa课程 Python 3 programming 输出每一行句子的第三个单词
查看>>
Returning a value from a function
查看>>
coursesa课程 Python 3 programming Functions can call other functions 函数调用另一个函数
查看>>
coursesa课程 Python 3 programming The while Statement
查看>>
course_2_assessment_6
查看>>
coursesa课程 Python 3 programming course_2_assessment_7 多参数函数练习题
查看>>
coursesa课程 Python 3 programming course_2_assessment_8 sorted练习题
查看>>
在unity中建立最小的shader(Minimal Shader)
查看>>
1.3 Debugging of Shaders (调试着色器)
查看>>
关于phpcms中模块_tag.class.php中的pc_tag()方法的含义
查看>>
vsftp 配置具有匿名登录也有系统用户登录,系统用户有管理权限,匿名只有下载权限。
查看>>
linux安装usb wifi接收器
查看>>
多线程使用随机函数需要注意的一点
查看>>
getpeername,getsockname
查看>>
让我做你的下一行Code
查看>>
浅析:setsockopt()改善程序的健壮性
查看>>