Chinese garbled characters in JSP of the SSH Project

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.