package cn.lijun.request;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
* @author lijun
* @date 2019/7/9 15:25
*/
@WebServlet(urlPatterns = "/chinese")
public class ChineseServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
// 提交参数有中文乱码
request.setCharacterEncoding("utf-8");
String username = request.getParameter("username");
System.out.println(username);
}

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}


}