Jsp pageEncoding and ContentType

I make my jsp file as follows:

<%@ page language="java" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Insert title here</title>
</head>
<body>
    Hello
</body>
</html>

I did not define contentType, only the specific pageEncoding, then I saw index_jsp.java, I found the code fragment as follows:

response.setContentType("text/html;charset=ISO-8859-1");

then I change pageEncoding to "UTF-8", I find the code snippet as follows:

response.setContentType("text/html;charset=UTF-8");

why? I did not distinguish between contentType, but the result is the value of pageEncoding, let's say that if I did not give up contentType in jsp, then the default pageEncoding parameter is used in the serlvet container?

+4
source share
1 answer

JSP , JSP . page , , .. , MIME text/plain, JSP text/html ( ISO-8859-1).

0

All Articles