How to implement JSP with tomcat
This article will explain in detail how to achieve JSP in tomcat. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
I'll tell you how tomcat implements JSP.
Preliminary knowledge:
1. Bytes and unicode
The Java kernel is unicode, even class files, but many media, including file / stream, are saved.
It uses byte streaming. So Java has to convert these byte streams through lines. Char is unicode and byte is byte.
[@ more@] the byte/char interchange function in Java is found in the middle of the sun.io package. Where the ByteToCharConverter class is the medium scheduling
Can be used to tell you that you use Convertor. Two of the commonly used static functions are
Public static ByteToCharConverter getDefault ()
Public static ByteToCharConverter getConverter (String encoding)
If you do not specify converter, the system will automatically use GBK,EN on the current Encoding,GB platform
8859_1
Let's take a simple example:
Your GB code is: 0xC4E3, unicode is 0x4F60
You use:
-- encoding=gb2312
-- byte b [] = {(byte) u00c4, (byte) u00E3}
-- convertor=ByteToCharConverter.getConverter (encoding)
-char [] c=converter.convertAll (b)
-- for (int itemositani)