Spring Web MVC
MVC
建立连接
@RequestMapping注释介绍
@RequestMapping的使用
@RequestMapping是get还是post请求?
指定GET/POST方法类型
请求
传递单个参数
传递两个参数
服务器端报错如下
传递多个参数或者传递一个对象
将这些参数封装为一个对象
public class Person {
Integer id;
String name ;
Integer age;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
@Override
public String toString() {
return "Person{" +
"id=" + id +
", name='" + name + '\'' +
", age=" + age +
'}';
}
}
后端参数重命名
浏览器发送get请求和postman发送get请求
传递数组
传递集合
传递JSON数据
传递JSON对象
获取URL中的路径变量
上传文件
保存文件到某一个地方
Cookie和Session
获取Cookie
伪造Cookie值
Spring下获取Cookie
获取Session
通过Spring获取Session
第3种方式获取Session
获取header
复习Cookie和Session
创建静态页面