JSP之中文乱码解决方法实例代码
JSP之中文乱码解决方法实例代码如下:<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%
!String getString(String param) {
String tmp;
try {
byte[] strBytes = param.getBytes("ISO8859-1");
tmp = new String(strBytes, "GBK");
return tmp;
} catch (Exception e) {
return null;
}
}
%>
<%
String uname = getString(request.getParameter("uname"));
%>
<html>
<head><title>样本</title></head>
<body>
姓名:<%=uname %>
</body>
</html>
补充:Web开发 , Jsp ,