成人AV在线无码|婷婷五月激情色,|伊人加勒比二三四区|国产一区激情都市|亚洲AV无码电影|日av韩av无码|天堂在线亚洲Av|无码一区二区影院|成人无码毛片AV|超碰在线看中文字幕

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請(qǐng)求中,@requestbody不適用,因?yàn)闆]有httpentity。

在post請(qǐng)求中,通過httpentity傳遞的參數(shù)必須在請(qǐng)求頭中聲明數(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)容類型,則傳遞的默認(rèn)參數(shù)為application/x-www-form-urlencoded type)

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

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

可以這樣處理亂碼

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

datagridtojson是路徑名。