微服务 教程
1085个小节阅读:196.7k
目录
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
编写SpringMVC核心配置文件springmvc.xml,该文件和Spring配置文件写法一样。
xxxxxxxxxx
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<!-- 扫描包 -->
<context:component-scan base-package="com.itbaizhan"/>
<!-- 开启SpringMVC注解的支持 -->
<mvc:annotation-driven/>
</beans>
编写控制器
xxxxxxxxxx
@Controller
public class MyController1 {
// 该方法的访问路径是/c1/hello1
@RequestMapping("/c1/hello1")
public void helloMVC(){
System.out.println("hello SpringMVC!");
}
}
使用tomcat插件启动项目,访问 http://localhost:8080/c1/hello1
1. 使用SpringMVC必须要配置的是
A 监听器
B IOC容器
C 前端控制器
D 编码过滤器
1=>C