First, for example, when the request URL is like this, the front domain port is omitted, .../test/downloadservlet/filepaht=f:/hello world. rmvb
Hello world. These strings will cause garbled problems because of the iso-8859-1 encoding of the address disorder.
The method is to encode the request parameter value after obtaining the request parameter, that is, converting it to a byte array, and then decoding the byte array back into a string.
String str=request.getparameter ("name");
Byte[] Bytes=str.getbytes ("iso-8859-1");
String name=new string (bytes, "Utf-8");
This will be able to get the right path, the implementation of the file download.
There is another way, in other people's place, I have not tried, we can try ...
String str=request.getquerystring ();
Decoding strings using Urldecoder
String Str1=java.net.urldecoder.decode (str, "utf-8");
String[] Parastrings=str1.split ("&");
Parastrings[0] is the first argument, and so on ...
for (String parastring:parastrings)
{
String[] Namevalue=parastring.split ("=");
Namevalue[0] is the form's name,namevalue[1] is the value of the form name
}