Solve the Problem of garbled characters when the jsp: include file is referenced, jspinclude
Before explaining the problem, let's take a look at the garbled page in the iframe on the left side of the picture below;
This is the garbled code that makes me Tangle for a while:
This error occurs when the <jsp: include> label is referenced on this garbled page;
Source code:
At first, I thought it was a file encoding problem, so various solutions were possible;
It is said that when jsp include dynamic files (jsp files), code can be added to the header of the included jsp file:
<% @ Page language = "java" contentType = "text/html; charset = UTF-8" pageEncoding = "UTF-8" %>
For example:
Even if the problem persists, why?
In fact, there is no mistake in this method on the Internet. I personally think that some problems in specific operations cannot be treated equally, so we must treat them differently;
Solution:
After nearly half an hour of hard work, I added the following code to the first line of the referenced and referenced files angrily, And the headache then vanished;
<% @ Page language = "java" contentType = "text/html; charset = UTF-8" pageEncoding = "UTF-8" %>