0

i want to show encoded url on my web browser address bar when corresponding url is going. i aleady get url and encoded by using given code.

       String getURL=request.getRequestURL().toString();
       out.println(getURL);
       String output = URLEncoder.encode(getURL);
       out.println(output);
4

1 回答 1

0

您只需对单个查询字符串参数名称和/或值进行编码。

String url = "http://mysite.com/query?q=" + URLEncoder.encode("bla bla", "ISO-8859-1"); // Or "UTF-8".
于 2013-08-10T11:11:28.770 回答