spring mvc 同時支持get和post請求

@RequestMapping(value = "/api/component/imgconf/getimgconf",method = {RequestMethod.POST, RequestMethod.GET})
@ResponseBody
public Object getImgConf(HttpServletRequest request,
	@RequestParam(value = "downImageConfigRequest", required = true) String json){
	//此處省略很多代碼
}

這樣終端發起請求的時候可以用post也可以用get。get的可以這樣請求/api/component/imgconf/getimgconf.do?json="參數值"

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章