The value of a text box in JSP is obtained through the El expression. This is a search function. After Entering Chinese characters, the search is successful. However, after the search is successful, the text box is garbled.
Filters, unified JSP page code, etc. have not been solved after finding them online for a long time. Maybe it was found that I couldn't understand them and didn't use them. Finally, when I found that the Chinese characters on the pages were passed into the bean, garbled characters are generated at set,
So here in set, we use:
Try
{
Keyword = new string (keyword. getbytes ("ISO-8859-1"), "utf8 ");
Keyword = java.net. urldecoder. Decode (keyword, "UTF-8 ");
}
Catch (exception E)
{
E. getmessage ();
}
Convert to get through El expression on the page. However, if multiple pages exist after the page is searched, click another page and set again. Therefore, a Boolean expression is used to control the operation, if you click the page instead of searching, It will be OK if the set in the bean is not converted.
I don't know what else is involved in this conversion. I hope you can tell me the problem.