@RequestParam和@PathVariable的区别和使用
请求路径上的区别:很明显一个是 https:url ?键值对,一个是https:url /参数,区别很明显
@PathVariable主要用于接收http://host:port/path/{参数值}数据。
@RequestParam主要用于接收http://host:port/path?参数名=参数值数据,这里后面也可以不跟参数值。
@RequestParam用于获取参数,可获取?username="20"这种?后面的参数值
如:访问路径为:http://localhost:8080/billing/pay/update?sys_account_id=20&newPassword1=2222&newPassword1=45516
当传入参数的名字和方法中的名字相同时,可以直接@RequestParam String sys_account_id,如请求 url:http://localhost:8080/billing/pay/up