In this section, we will discuss about how to set "pageEncoding" attribute & it's uses with example.
The JSP page encoding is the character encoding in which the file is encoded. For JSP pages in standard syntax, the page encoding is determined from the following sources:If none of these is provided, ISO-8859-1 is used as the default page encoding.
Example: In this example, we will create two JSP pages with the same content except their "pageEncoding" attribute. First JSP page sets attribute "GBK" while second JSP page sets default value i.e." ISO-8859-1 ".
pageencoding1.jsp
|
<%@page pageEncoding="GBK" %> |
OUTPUT

pageencoding2.jsp
|
<%@page pageEncoding="ISO-8859-1" %> |
OUTPUT

NOTE: In this example, see the "æ±" string . The "GBK" pageEncoding display a different thing as compared to "ISO-8859-1" encoding. The "ISO-8859-1" encoding is clearly visible.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.