admin管理员组

文章数量:1391798

I'm trying to set a jsp file to load but i have a doubt on it.

What is the content-type of a .jsp file?

application/json or application/javascript ?

I'm trying to set a jsp file to load but i have a doubt on it.

What is the content-type of a .jsp file?

application/json or application/javascript ?
Share Improve this question edited Jan 22, 2018 at 13:04 soorapadman 4,5097 gold badges37 silver badges48 bronze badges asked Jan 22, 2018 at 13:00 John DoeJohn Doe 391 gold badge1 silver badge2 bronze badges 3
  • Do you want to run that file or download it? – rollstuhlfahrer Commented Jan 22, 2018 at 13:02
  • run that file. @rollstuhlfahrer – John Doe Commented Jan 22, 2018 at 13:03
  • You mean default jsp ? contentType="text/html;charset=UTF-8" – soorapadman Commented Jan 22, 2018 at 13:03
Add a ment  | 

1 Answer 1

Reset to default 2

The default Content Type is text/xml see Oracle's JSP Globalization Support

Without any page directive settings, default settings are as follows:

The default MIME type is text/html for traditional JSP pages; it is text/xml for JSP XML documents.

The default for the page source character encoding (for translation) is ISO-8859-1 (also known as Latin-1) for traditional JSP pages; it is UTF-8 or UTF-16 for JSP XML documents.

The default for the response character encoding is ISO-8859-1 for traditional JSP pages; it is UTF-8 or UTF-16 for JSP XML documents.

You can override it with the following attributes (specifically contentType):

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" 
                         pageEncoding="US-ASCII" %>

本文标签: javascriptWhat is the contenttype of a jsp fileStack Overflow