- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is contentType attribute in JSP?
The contentType attribute sets the character encoding for the JSP page and for the generated response page. The default content type is text/html, which is the standard content type for HTML pages.
If you want to write out XML from your JSP, use the following page directive −
<%@ page contentType = "text/xml" %>
The following statement directs the browser to render the generated page as HTML −
<%@ page contentType = "text/html" %>
The following directive sets the content type as a Microsoft Word document −
<%@ page contentType = "application/msword" %>
You can also specify the character encoding for the response. For example, if you wanted to specify that the resulting page that is returned to the browser uses ISO Latin 1, you can use the following page directive −
<%@ page contentType = "text/html:charset=ISO-8859-1" %>
- Related Articles
- What is autoFlush attribute in JSP?
- What is errorPage attribute in JSP?
- What is isErrorPage attribute in JSP?
- What is extends attribute in JSP?
- What is import attribute in JSP?
- What is info attribute in JSP?
- What is isThreadSafe attribute in JSP?
- What is language attribute in JSP?
- What is session attribute in JSP?
- What is isELIgnored Attribute in JSP?
- What is isScriptingEnabled Attribute in JSP?
- What is a buffer attribute in JSP?
- What do the id and scope attribute mean in the action elements in JSP?
- How can I create custom tag in JSP which can accept attribute from parent jsp page?
- What is a request object in JSP?

Advertisements