当前位置:网站首页>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
下载资源
调试页面
边栏推荐
- A master in the field of software architecture -- Reading Notes of the beauty of Architecture
- Zoom through the mouse wheel
- (column 22) typical column questions of C language: delete the specified letters in the string.
- Auto. JS learning notes 17: basic listening events and UI simple click event operations
- LTE CSFB process
- Pay attention to the details of pytoch code, and it is easy to make mistakes
- H3C V7版本交换机配置IRF
- H3C S5820V2_ Upgrade method after stacking IRF2 of 5830v2 switch
- Clear floating mode
- Winter 2021 pat class B problem solution (C language)
猜你喜欢
26file filter anonymous inner class and lambda optimization
B站刘二大人-线性回归 Pytorch
Jushan database appears again in the gold fair to jointly build a new era of digital economy
华为路由器如何配置静态路由
【无标题】
实践分享:如何安全快速地从 Centos迁移到openEuler
27io stream, byte output stream, OutputStream writes data to file
LTE CSFB process
Garbage collector with serial, throughput priority and response time priority
What is independent IP and how about independent IP host?
随机推荐
Sequoiadb Lake warehouse integrated distributed database, June 2022 issue
数字经济破浪而来 ,LTD是权益独立的Web3.0网站?
How to use PHP string query function
MIT6.s081-2020 Lab2 System Calls
嵌入式面试题(一:进程与线程)
The difference and usage between continue and break
Luogu [Beginner Level 4] array p1427 number game of small fish
Auto.js学习笔记17:基础监听事件和UI简单的点击事件操作
PDK工艺库安装-CSMC
巨杉数据库再次亮相金交会,共建数字经济新时代
[Jiudu OJ 08] simple search x
通讯录管理系统链表实现
Zoom through the mouse wheel
Construction of yolox based on paste framework
移植InfoNES到STM32
Game push: image / table /cv/nlp, multi-threaded start!
养了只小猫咪
实践分享:如何安全快速地从 Centos迁移到openEuler
Huawei BFD configuration specification
类和对象(一)this指针详解