HTTP GET请求URL设置和交互

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/chenbetter1996/article/details/83213879

GET请求要传递的参数都在URL里,不在请求体中
如有以下URL:

xxxx/login?username=52318&code=8888
格式是:/请求名?参数1=值1&参数2=值2

那么后台的URL截取配置为login请求名即可

注解配置:
@RequestMapper("/login")
或者web.xml配置
<url-pattern>/login</url-pattern>

同时后台可以这样获取参数

String username = httpServletRequest.getParameter("username");
int code = Integer.parse(httpServletRequest.getParameter("code"));

猜你喜欢

转载自blog.csdn.net/chenbetter1996/article/details/83213879
今日推荐