What is MIME type?

An HTTP response has both header and body. The header info tells the browser about the protocol being used, whether the request is successful and what kind of content is included in the body. The body contains the contents for the browser display.
The “what kind of content” in the header part is known as MIME type.

Some known MIME types:








































Type Meaning
application/vnd.ms-excel Creates Excel spread sheet
application/msword Microsoftt word
image/gif GIF image
image/jpeg JPEG image
text/plain Plain text
text/html HTML document
text/xml XML document


Example
response.setContentType(“application/vnd.ms-excel”);
PrintWriter out=response.getWriter();
out.println(“\tName \tMath \tPhy \tChem \tTot”);
out.println(“\tAjay \t89 \t70 \t61 \t=sum(B2:D2)”);
out.println(“\tAjay \t83 \t77 \t76 \t=sum(B2:D2)”);

No comments:

Post a Comment