Why Do We Use Response?

Upload and start working with your PDF documents.
No downloads required

How To Type on PDF Online?

Upload & Edit Your PDF Document
Save, Download, Print, and Share
Sign & Make It Legally Binding

Easy-to-use PDF software

review-platform review-platform review-platform review-platform review-platform

Why do we use response.set content type in Servlet?

In easy words . By using this method you are just specifying what kind of data you are going to send to the client. Technical Definition . Before sending data to client , the Servlet container informs the client browser of what type of data is being sent now. The data that can be sent may be simple plain text, html form, xml form, image form of type gif or jpg, excel sheet etc. To send this information, the Servlet container uses response object with the method setContentType . The setContentType(String) method takes a string parameter and does not return anything (returns void). In "text/html", "text" is known as type and "html" known as subtype. A type contains many subtypes Some ways in which method is used . response.setContentType("text/html"); // the most popular one response.setContentType("text/plain"); response.setContentType("text/css"); // Cascading Style Sheet response.setContentType("application/html"); response.setContentType("image/gif"); response.setContentType("application/zip"); response.setContentType("application/pdf"); Enjoy Learning !!!

Customers love our service for intuitive functionality



46 votes