仅做为笔记使用
<form action="http://localhost:2333/test">
<input type="text" name="username">
<input type="submit" value="提交">
</form>
前端表单提交
action :提交的网址
在表单中 “上传文件时“, enctype 格式为multipart/form-data

后端接收
@Controller
public class testController {
@RequestMapping("/test")
@ResponseBody
public String test( String username){
System.out.println(username);
return username;
}
}
注意
后端接收参数 必须为前端表单提交的name属性
例如
<input type="text" name="username">
name为 username ,则 后端接收参数 必须为 username
Http请求组成

Json 请求

请求格式为 josn格式时,需要在后端 加上@RequestBody 注解
@ResponseBody 注解 作用 : 返回时,格式也为josn
json请求时,汉字不需要转码,可直接发送
数据格式小结
