1 回答

TA貢獻(xiàn)1839條經(jīng)驗(yàn) 獲得超15個(gè)贊
你的“<\b>”打破了它。如果刪除它并添加換行符“\n”,它應(yīng)該可以工作。像這樣:
String a = ("\nThe current Project-Status is: " + test.get("status") + "\n");
String b = "";
for (int i = 0; i < gates.length(); i++) {
status = gates.getJSONObject(i).getString("status");
String metric = gates.getJSONObject(i).getString("metricKey");
b = b + ("Status: " + status + " | Metric: " + metric + "\n");
}
您還返回純文本。因此,要正確顯示它,請(qǐng)?zhí)砑印皃roducts =”text/plain”以返回格式化的字符串。
@GetMapping(value = "/gates", produces = "text/plain")
然后你的輸出將顯示換行符。這樣您就可以應(yīng)用進(jìn)一步的格式。
- 1 回答
- 0 關(guān)注
- 117 瀏覽
添加回答
舉報(bào)