我想在春季啓動時通過POST方法發送參數,但參數全部爲空。如何在春季開機時通過POST方法發送參數?
@RequestMapping(value = "/upload", method = RequestMethod.POST)
public String upload(@RequestParam(value = "path", defaultValue = "") String path) {
return "hello " + path;
}
,當我試圖測試它這個錯誤是出現
{
"timestamp": 1512262419197,
"status": 500,
"error": "Internal Server Error",
"exception": "org.springframework.web.bind.MissingPathVariableException",
"message": "Missing URI template variable 'path' for method parameter of type String",
"path": "/upload"
}
你能否提供一些關於你如何提出這個請求的細節?例如,添加用於發出此請求的'cURL'命令。也可以顯示控制器類以及? – Edd
你的jsp或api調用方法在哪裏? –