Solve Chinese garbled in JSP

xiaoxiao2021-03-06  72

JSP is easy to appear garbled, sometimes it feels very annoying, today has time to summarize your own method of solving garbled under Tomcat.

1. JSP page Chinese who does not call database data is also garbled, generally adds to the beginning of the JSP page.

<% @ Page ContentType = "text / html; charset = GBK" Language = "Java" ErrorPage = ""%>

2. The data submitted to the database is garbled through the form. Generally, it can be solved with the transcodation. I am solved by adding Filter and JDBC: URL plus parameters in Tomcat 5.

1. Filter uses the Tomcat comes with the one :). Specify on Web.xml: set character encoding filters.setcharacterencodingFilter Encoding GBK

2, JDBC: URL is:? Useunicode = true & characterencoding = GBK

Through the above method, basically solve Chinese garbled.

转载请注明原文地址:https://www.9cbs.com/read-92918.html

New Post(0)