If the form action is list. Do? Act = Go & State = 5
Then, the request. getparameter method is used to obtain the values of act and state.
If you want to upload 'go & State = 5' as a string, act = 'go & State = 5' contains ;/? : @ & =+ $, # Special characters that have special meanings in Uris.
To get the exact act value 'go & State = 5' on the server side, You must escape special characters such as & =.
Top-level functions of JavaScript (global functions ):
The encodeuricomponent () function can encode a string as a "part" of the URI. For example, if 'go & State = 5' is encoded, it will be ;/? : @ & =+ $, # Encode
The encodeuri () function can encode a string as an "1 whole" URI. For example,/my first/list. jsp? A = 12 & B = 45 & C = 89, & is the parameter separator, so it is not true ;/? : @ & =+ $, # Encode
The decodeuricomponent () function can decode the uri of the encodeuricomponent () function.
The decodeuri () function can decode the URI encoded by the encodeuri () function.
Example:
JSCode
Encodeuricomponent (",/? : @ & =+ $ # ") Returned result: % 2C % 2f % 3f % 3A % 40% 3D % 2B % 26% 23
Encodeuricomponent ("http://www.w3school.com.cn/P 1/") returned results: HTTP % 3A % 2f % 2fwww.w3school.com.cn % 2fp % 201% 2f
Encodeuri (",/? : @ & = + $ # ") Returned result :,/? : @ & =+ $ #
Encodeuri ("http://www.w3school.com.cn/My first/") returned results: http://www.w3school.com.cn/My%20first/