• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

contentType vs mimeType

 
MInu
Ranch Hand
Posts: 517
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...

What is the difference between

<%@ page contentType="text/html"%>
<%@ page mimeType="text/html"%>

Thanks
 
Colin Fletcher
Ranch Hand
Posts: 200
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mime types are definitions of what kind of file. The content type uses mime types to tell the browser what to expect.

eg.

Mime Type: application/x-pdf = PDF File
Mime Type: text/plain = plain text file (no html formatting)
Mime Type: text/html = text file with html formatting..

Hope this helps.
 
Jose Esteban
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by minu su:
What is the difference between

<%@ page contentType="text/html"%>
<%@ page mimeType="text/html"%>


The main difference is that the second one is incorrect since mimeType is not an attribute of the page directive.

Besides, the contentType attribute defines the MIME type and the character encoding for the response of the JSP page.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic