html>
<html>
<head>
<meta charset="UTF-8">
<title>index界面title>
head>
<body>
<h2>Hello World!中文测试h2>
body>
html>
@WebServlet("/goto3")
public class GoToServlet extends HttpServlet {
@Override
protected void doGet(){...}
servlet也要配置编码格式
https://blog.csdn.net/weixin_43002640/article/details/120496537?spm=1001.2014.3001.5501
是不是你的IDE 编码变了,看看你IDE默认的编码吧
tomcat下conf/server.xml,添加URIEncoding="UTF-8"。
已解决,谢谢各位朋友的分享提案!
各种测试之后,发现html网页没乱码,只有jsp页面乱码,精确搜索到百度,添加:
<%@page contentType="text/html;UTF-8" pageEncoding="UTF-8" %>
idea新建jsp文件会自动添加<%@ page contentType="text/html;charset=UTF-8" language="java" %>效果相同,
我因为中途有意把jsp改成html,但是就是那个小错误,导致我最终又改成jsp了,但是把不符合html的内容剔除了,
现在知道了