A hyperlink URL in Vm needs to be spliced into Chinese as a parameter of the Get request. If spliced directly, it will be garbled after being passed to the parameter object of the background Action and taken out. It needs to be encoded and then spliced to the URL.
The solution is to add a member variable in Action to save the encoded Chinese parameters. When rendering the vm page, take out the value of this variable and then splice the hyperlink.
The problem encountered here is : when calling the encode() method of java.net.URLEncoder, if the specified character set parameter is not displayed, then URLEncoder will use the default character set. This default character set will produce different results when running the main() method in Eclipse and running the Web application in Tomcat, thus affecting the encoding results.
x-www-form-urlencoded
String
to betranslated. String
.