A hyperlink URL in VM needs to be spliced with Chinese as a parameter for Get request. If splicing it directly, it will be garbled after being removed after being passed to the parameter object of the background Action. It needs to be encoded and then spliced onto the URL.
The solution is to add a member variable to the Action and save the encoded Chinese parameters. Take out this variable value when rendering the vm page 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. The default character set is running the main() method in Eclipse and running the web application in Tomcat. The result is different, so it affects the encoding result.Copy the code