The problem I encountered is: the parameter content in the url contains & matches. I have two ways to solve it
. One method is: use JS to transcode on the page. The example is as follows (front-end processing)
${group.cn }) 2. You can use encodeURI as a whole when making URL jumps. For example: Location.href=encodeURI ("http://cang.baidu.com/do/s?word=Baidu &ct=21");
3. You can use escape when js uses data. For example: history record in collection.
4. When escape encodes unicode values other than 0-255, it outputs the %u**** format. In other cases, the encoding results of escape, encodeURI, and encodeURIComponent are the same.
The most commonly used should be encodeURIComponent, which converts Chinese, Korean and other special characters into url encoding in utf-8 format, so if you need to use encodeURIComponent to pass parameters to the background, you need background decoding to support utf-8 (The encoding method in the form is the same as the encoding method of the current page)
There are 69 characters that are not encoded by escape: *, , -, ., /, @, _, 0-9, a-z, A-Z
There are 82 characters that encodeURI does not encode: !, #, $, &, ', (, ), *, , , , - , . , / , : , ; , = , ? , @ , _ , ~ , 0-9 , a-z , A-Z
encodeURIComponent has 71 unencoded characters: !, ' , ( , ) , * , - , . , _ , ~ , 0-9 , a-z , A-Z
The following is in the url Possible special characters and encoded values in the URL: (omitted)
It was found in the project that the encodeURI() encoding conversion is performed directly on the parameter part of the URL, and when the background servlet obtains it through getParamater(), The correct value can be obtained directly without conversion. Note: The parameters are not used in Chinese, and the framework uses the struts framework.