The initial content type for the response (including the character set) is determined as shown in the "Output Content Type" column in Table JSP.3-1. In all cases, the container must call response.setContentType() with the initial content type before processing the page.
The content type (and character set) can then be changed dynamically by calling setContentType() or setLocale() on the response object. The most recent call takes precedence. Changing the content type can be done up until the point where the response is committed. Data is sent to the response stream on buffer flushes for buffered pages, or on encountering the first content (beware of whitespace) on unbuffered pages. Whitespace is notoriously tricky for JSP Pages in JSP syntax, but much more manageable for JSP Documents in XML syntax.
Default JSP Type :
language CDATA "java"
extends %ClassName; #IMPLIED
contentType %Content; text/xml; UTF-8
import CDATA #IMPLIED
session %Bool; true
buffer CDATA 8kb
autoFlush %Bool; true
isThreadSafe %Bool; true
info CDATA #IMPLIED
errorPage %URL; #IMPLIED
isErrorPage %Bool; false
>
1.
2.
3.
How set the Content Type in JSP :
Using the setContentType() of the response we can change the MIME type and encoding format.
EX :
response.setContentType("text/html");
To check Pre-defined Content Type : click Here
No comments:
Post a Comment