如何设置 mime-type 或者 response.setContentType

具体如何设置 response.setContentType,可以根据你需要响应返回的数据,
查看 Tomcat 下的 conf 下的 web.xml
在这里插入图片描述
比如我们这里要返回一个 JSON 的响应数据:
在这里插入图片描述
所以可以设置为:

response.setContentType("application/json;charset=utf-8");
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章