Skip to main content

Setting Content Type

Learn Setting Content Type (Handling Req & Res, JSP Servlets) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

What is Content Type? • Content-Type tells the browser what type of data the server is sending. • text/html → HTML page • text/plain → Normal text • application/json → JSON data • application/pdf → PDF file • We use response.setContentType() to set it.

More lessons in Handling Req & Res