当前位置:网站首页>ContentType的作用
ContentType的作用
2022-07-06 05:48:00 【緈福的街口】
文章目录
一、ContentType的作用
ContentType决定浏览器采用何种方式对响应体进行处理
二、不同类型的表现效果
对以下程序实现不同表现效果
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String output = "<h1><a href='http://www.baidu.com'><span>百度</span></a></h1>";
response.setContentType("text/html;charset=utf-8");
response.getWriter().println(output);
1、text/html:html文档
text/html
html文档
调试页面
2、text/plain:纯文本
text/plain
纯文本
调试页面
3、text/xml:XML文档
text/xml
XML文档
调试页面
4、application/x-msdownload:需要下载的资源
application/x-msdownload
下载资源
调试页面
边栏推荐
猜你喜欢
随机推荐
What preparations should be made for website server migration?
My 2021
Quantitative description of ANC noise reduction
Is it difficult for an information system project manager?
P2802 go home
The digital economy has broken through the waves. Is Ltd a Web3.0 website with independent rights and interests?
[experience] install Visio on win11
局域网同一个网段通信过程
[Tang Laoshi] C -- encapsulation: classes and objects
After the project is released, index Html is cached
B站刘二大人-多元逻辑回归 Lecture 7
Text classification still stays at Bert? The dual contrast learning framework is too strong
OSPF configuration command of Huawei equipment
Game push: image / table /cv/nlp, multi-threaded start!
continue和break的区别与用法
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Embedded interview questions (I: process and thread)
应用安全系列之三十七:日志注入
Selective parameters in MATLAB functions
什么是独立IP,独立IP主机怎么样?