This article illustrates the difference between Response.setcontenttype and response.setcharacterencoding in JSP. Share to everyone for your reference, specific as follows:
Response.setcontenttype
Sets the content type of the response sent to the client, which can include a character encoding description.
That means that the server sits on this setting, and then he will play a role in the browser, deciding how to encode when you open the browser
If the method is invoked before the Response.getwriter () is invoked, the character encoding of the response is set only from the given content type. If the method is invoked after Response.getwriter () is invoked or after being committed, the character encoding of the response is not set, and in the case of using the HTTP protocol, the method sets the Content-type entity header
Response.setcharacterencoding sets the encoding of the response
If the server side uses Response.setcontenttype to set the encoding format,
Then you should use Response.setcharacterencoding to specify the encoding format, so that the previous settings will be blocked off
General Recommended Settings response.setcharacterencoding
Response.setcontenttype often encounter failures (settings but often do not work)
I hope this article will help you with JSP program design.