Parameters Chinese Code Problem in Struts Application

xiaoxiao2021-03-06  84

In the ActionForm process provided by Struts, I found such a phenomenon for Chinese: whether the form is the Struts label or HTML tag, you can use an actionform's getter, setter to get the element value of the form (their role The effect is the same as the request.getParameter () method), but if you want to display and get Chinese, you must meet one of the following:

The form uses method = "post" encType = "multipart / form-data" Submit this unique shortcoming is that IE will pop up when IE will pop up, IE make changes to us, add the automatic refresh list page, etc. The application brings trouble; the form uses method = "get" to submit parameters to pass through the URL, so that the parameters must be transformed in the server, and the conversion is also converted in the setter of ActionForm. The form uses the method = "post" mode to submit the parameters through the Request stream, so that the parameters must be translated in the server, and the conversion is also converted in the setter of ActionForm to properly display and acquire; Attached: The following functions can be used in the way

Public Static String ASC2GB (String ASC) {String Ret; if (ASC == NULL) Return ASC; Try {Ret = New String (ASC.GetBytes ("ISO8859_1"), "GB2312");} catch (Exception E) { RET = ASC;} Return Ret;

转载请注明原文地址:https://www.9cbs.com/read-108145.html

New Post(0)