When we use include to include JSP files, we find that there are redundant blank lines on the final generated page, and there is a character that cannot be displayed in the source code. After checking some articles, we find that the problem lies in the editor. Previously I used editplus 2.11 to save the JSP file as UTF-8 encoding and inserted three invisible characters (0xef 0xbb 0xbf, BOM) at the beginning of the file ), it represents the Unicode mark (BOM ). Therefore, the solution is to remove the check box before BOM when saving the code. Emeditor and editplus 2.21 can be used for saving.
& #65279; indicates "Zero Width no-break space". For more information, see
Http://www.fileformat.info/info/unicode/char/feff/index.htm
Test code for problem discovery:
Test. jsp
---------------------
<% @ Page pageencoding = "UTF-8" %>
<% @ Page contenttype = "text/html; charset = UTF-8" %>
<% @ Include file = "1.jsp" %>
<Table>
<Tr> <TD> testing </TD> </tr>
</Table>
<% @ Include file = "2.jsp" %>
1. jsp
---------------------
<% @ Page pageencoding = "UTF-8" %>
<% @ Page contenttype = "text/html; charset = UTF-8" %>
<Div> hehe </div>
2. jsp
---------------------
<% @ Page pageencoding = "UTF-8" %>
<% @ Page contenttype = "text/html; charset = UTF-8" %>
<Div> Haha </div>
The generated Page code is as follows:
---------------------
& #65279;
<Div> hehe </div>
<Table>
<Tr> <TD> testing </TD> </tr>
</Table>
& #65279;
<Div> Haha </div>
---------------------