html页面中写一个表单:
<form method="post" action="/demo/test">
<p>
名字:<input name="name" type="text" >
</p>
<p>
年龄:<input name="age" type="text">
</p>
<p>
<input type="submit" value="submit">
</p>
</form>
在这个表单中规定了:表单中的数据会提交给/demo/test这个方法
@RequestMapping(path = "/demo/test",method = RequestMethod.POST)
@ResponseBody
public String test(String name,int age)
{
System.out.println(name);
System.out.println(age);
return "hello world";
}