java代码020

code020.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>解决中文乱码</title>
</head>
<body>
<%
    String str1 = new String(request.getParameter("name").getBytes("iso-8859-1"),"utf-8");
    String str2 = request.getParameter("sex"); //没有编码转换的,就是乱码
%>
    name参数的值为:<%= str1 %>
    sex参数的值为:<%= str2 %>
</body>
</html>

评论

h
hw_7864

⭐️ Admin快速开发: https://show.cool-admin.com/

赞 0
h
hw_7864

⭐️ 官方文档: https://cool-js.com

赞 0
h
hw_7864

⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld

赞 0