Answer the question
In order to leave comments, you need to log in
How to make a request from one servlet to another using a Russian word in the parameter value?
There are two classes inheriting HTTPServlet from one to the other I send a request using the following code
String data = URLEncoder.encode("phrase","UTF-8") + "=" + URLEncoder.encode(phrase, "UTF-8");
data += "&" + URLEncoder.encode("id", "UTF-8") + "=" + URLEncoder.encode(userId, "UTF-8");
URL url = new URL(SERVER_URL);
URLConnection connect = url.openConnection();
connect.setDoOutput(true);
OutputStreamWriter out = new OutputStreamWriter(connect.getOutputStream());
out.write(data);
System.out.println()
the Russian string in the request turns into a string of bits (2 for each letter), but at the same time, when servlet1 receives this string back, it displays it in its original form.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question