greenteaone

jsp默认的文件设置如下,这样访问web页面的时候,中文会出现乱码。

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1>你好,朋友</h1>
</body>
</html>

 

解决办法:更改编码方式为UTF-8,如下

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>你好,朋友</h1>
</body>
</html>

  

分类:

技术点:

相关文章:

  • 2021-11-28
  • 2021-07-03
  • 2022-12-23
  • 2021-09-04
  • 2021-11-28
  • 2021-09-19
  • 2021-11-23
猜你喜欢
  • 2021-12-04
  • 2021-12-08
  • 2021-11-28
  • 2021-06-25
  • 2021-12-14
相关资源
相似解决方案