Differences between the pageEncoding and contentType attributes on the JSP page: PageEncoding isJsp file itselfEncoding ContentTypeCharset refers to the content encoding when the server sends data to the client. JSP requires two "Encodings". pageEncoding is used in the first stage, UTF-8 to UTF-8 is used in the second stage, and the third stage is the webpage from Tomcat, with contentType. The first stage isJsp is compiled into. java, which reads jsp according to pageEncoding settings.The result is translated by the specified encoding scheme into the unified UTF-8 JAVA source code (namely. java), if pageEncoding is set wrong, or not set, it is the Chinese garbled. The second stage isCompilation from JAVA source code of JAVAC to java byteCodeNo matter what encoding scheme is used in JSP writing, after this stage, all the results are the UTF-8's encoding java source code. JAVAC uses the UTF-8's encoding to read the java source code and compile it into the UTF-8's encoding binary code (that is,. class), which is the JVM's specification for the constant string expression in the binary code (java encoding. The third stage is the JAVA binary code loaded and executed by Tomcat (or its application INER) in stage 2. The output result is displayed on the client, in this case, the parameter contentType hidden in phase 1 and Phase 2 is effective. ContentType |