国产成人毛片视频|星空传媒久草视频|欧美激情草久视频|久久久久女女|久操超碰在线播放|亚洲强奸一区二区|五月天丁香社区在线|色婷婷成人丁香网|午夜欧美6666|纯肉无码91视频

springmvc工作流程 requestbody和requestparam區(qū)別?

requestbody和requestparam區(qū)別?Requestbody處理httpentity傳遞的數(shù)據(jù),通常用于處理非內(nèi)容類型的數(shù)據(jù):application/x-www-form-urlenc

requestbody和requestparam區(qū)別?

Requestbody

處理httpentity傳遞的數(shù)據(jù),通常用于處理非內(nèi)容類型的數(shù)據(jù):application/x-www-form-urlencoded格式。

在get請求中,@requestbody不適用,因為沒有httpentity。

在post請求中,通過httpentity傳遞的參數(shù)必須在請求頭中聲明數(shù)據(jù)類型content type。Spring MVC使用由

handleradapter配置的httpmessage轉(zhuǎn)換器解析httpentity中的數(shù)據(jù),然后將其綁定到相應(yīng)的bean。

Requestparam

用于處理內(nèi)容類型:content encoded for application/x-www-form-urlencoded。(在HTTP協(xié)議中,如果未指定內(nèi)容類型,則傳遞的默認參數(shù)為application/x-www-form-urlencoded type)

@ResponseBody和 @RequestBody注解的區(qū)別?

@ResponseBody用于返回諸如son等字符串

可以這樣處理亂碼

@requestmapping(productions=“text/plaincharset=UTF-8”,value=“datagridtojson”)

datagridtojson是路徑名。