当前位置:网站首页>@Role of ResponseBody
@Role of ResponseBody
2022-06-30 14:15:00 【Full stack programmer webmaster】
effect :
This annotation is used to Controller The method returns the object , Through appropriate HttpMessageConverter After converting to the specified format , Write to Response Object's body Data area .
Use time :
The data returned is not html Pages for tags , When it's data in some other format ( Such as json、xml etc. ) Use ;
Such as , Back to a page Paging object
@ResponseBody
@RequestMapping("/localIdentifyCheckList")
public Page<TmCreditHistory> localIdentifyCheckList(String appNo){
Page<TmCreditHistory> page = new Page<TmCreditHistory>();
List<TmCreditHistory> tmCreditHistoryList = new ArrayList<TmCreditHistory>();
try {
tmCreditHistoryList = commonService.checkIdentifyForLocal(appNo);
} catch (ProcessException e) {
logger.error(LogPrintUtils.printAppNoLog(appNo, null)+" Failed to obtain identity information !["+e.getMessage()+"]");
}
for (TmCreditHistory tmCreditHistory : tmCreditHistoryList) {
page.getRows().add(tmCreditHistory);
}
return page;
}Such as : The return is json strand
@ResponseBody
@RequestMapping("/netWorkNciic")
public Json netWorkNciic(String appNo){
Json json = Json.newSuccess();
IdentifyCheckResp resp = null;
try {
resp = commonService.checkIdentifyForNetWork(appNo);
if (resp == null) {
IdentifyCheckResp identifyCheckResp = new IdentifyCheckResp();
identifyCheckResp.setRspMsg(" Online identity verification failed ! The system did not return the verification result !");
json.setS(true);
json.setObj(identifyCheckResp);
} else {
Date newDate = DateUtils.stringToDate(resp.getEntrustDate(),DateUtils.FULL_THRID_LINE);
resp.setEntrustDate(DateUtils.dateToString(newDate, DateUtils.FULL_SECOND_LINE));
json.setS(true);
json.setObj(resp);
}
} catch (ParseException e) {
logger.error(" Date format conversion error !"+e.getMessage());
} catch (Exception e) {
IdentifyCheckResp resp1 = new IdentifyCheckResp();
resp1.setRspMsg(" Online identity verification failed !["+e.getMessage()+"]");
resp1.setEntrustDate("");
json.setS(true);
json.setObj(resp1);
logger.error(LogPrintUtils.printAppNoLog(appNo, null)+" Online failed !["+e.getMessage()+"]");
}
return json;
}If you return a page, you don't need :
@RequestMapping("/whichQueryMethod")
public String whichQueryMethod(String localOrCis,String appNo){
setAttr("localOrCis", localOrCis);
setAttr("appNo", appNo);
return "apply/common/cis5OrgProductBut_V1.ftl";
}Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/106258.html Link to the original text :https://javaforall.cn
边栏推荐
- [the path of system analyst] Chapter 5 Software Engineering (Agile Development)
- Google Earth engine (GEE) -- converts string to number and applies it to time search (ee.date.fromymd)
- Pytoch viewing model parameter quantity and calculation quantity
- Go common lock mutex and rwmutex
- Go language for loop multivariable use
- 【科学文献计量】外文文献及中文文献关键词的挖掘与可视化
- Calculates the length of the last word in a string, separated by spaces
- Why does the folder appear open in another program
- QQ 居然被盗了?原因在这......
- 深入理解.Net中的线程同步之构造模式(二)内核模式3.内核模式构造物Mutex
猜你喜欢

Defi "where does the money come from"? A problem that most people don't understand

【刷题篇】爱吃香蕉的珂珂

重磅:国产IDE发布,由阿里研发,完全开源!
![【科研数据处理】[基础]类别变量频数分析图表、数值变量分布图表与正态性检验(包含对数正态)](/img/70/8bf226964118efb324ca4d339df654.png)
【科研数据处理】[基础]类别变量频数分析图表、数值变量分布图表与正态性检验(包含对数正态)

Flat shading with unity

Heavyweight: the domestic ide was released, developed by Alibaba, and is completely open source!

深入理解.Net中的线程同步之构造模式(二)内核模式4.内核模式构造物的总结

Google Earth Engine(GEE)——将字符串的转化为数字并且应用于时间搜索( ee.Date.fromYMD)

Embedded development: five C features that may no longer be prohibited

Attack and defense world web questions
随机推荐
DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703
Crypto questions
Jetpack compose for perfect screen fit
IM即时通讯应用开发中无法解决的“顽疾”
Knowledge dissemination cannot replace professional learning!
[Title brushing] avoid flooding
Geoffreyhinton: my 50 years of in-depth study and Research on mental skills
Click the TD cell of table to open the dialog pop-up window. After obtaining the value, put the value back into the TD cell
Numpy creates an empty array data = np empty(shape=[1, 64,64,3])
In the digital age, XDR (extended detection and response) has unlimited possibilities
重磅:国产IDE发布,由阿里研发,完全开源!
Getting started with shell Basics
MFQE 2.0: A New Approach for Multi-FrameQuality Enhancement on Compressed Video
Go language func function
[the path of system analyst] Chapter 5 Software Engineering (Agile Development)
get请求与post提交区别的简易理解
“即服务”,企业数字化转型的必然选择
Service online governance
可觀測,才可靠:雲上自動化運維CloudOps系列沙龍 第一彈
Laravel configures passport and returns token using JWT