JSP URL address Chinese transmission problem solving method

Source: Internet
Author: User


GetParameter gets all of the string types. Or is it the http://a.jsp tutorial? id=123 123, or a form that submits past data.
GetParameter: When used for client redirection, a link is clicked or a newsletters value is submitted, which is used to receive data when the value is passed with the form or URL redirection.
GetParameter is only the application server when you analyze the text of the request page you sent, get the value that you made when you set the form or URL redirect
-->

<%@ page contenttype= "text/html; charset=gb2312 "language=" java "import=" java.sql.* "errorpage=" "%>"
<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ">
<connector port= "8080" protocol= "http/1.1" uriencoding= "Utf-8"
connectiontimeout= "20000"
redirectport= "8443"/>
<!--
The special cause of my attention is uriencoding= "Utf-8", if not set, the URL passed on the Chinese can not be correctly decoded
-->

<body>
<%
string s = Request.getparameter ("s");
String str = Request.getparameter ("Nau");
Out.println (str+ "<br/>");
Pattern p = pattern.compile ("softname= (. *) [&$]");
Matcher m = p.matcher (str);
String softname = "";
while (M.find ()) {
Softname = M.group (1);
Out.println ("softname=" + softname);
}
Out.println (Str.replace (Softname,urlencoder.encode (Softname, "utf-8"));

%>
</body>

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.