测试开发进阶——spring boot——MVC——get访问——使用@RequestParam获取参数——使用默认值
控制器:
package com.awaimai.web;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
public class kzq
{
@RequestMapping("/param/requestparam22")
public String requestParam22(@RequestParam(value = "username",defaultValue = "abc21") String name)
{
return name;
}
}
web访问:




浙公网安备 33010602011771号