jsp编码问题

版权声明:转载请注明出处 交流请加QQ 156356969 https://blog.csdn.net/weixin_41957098/article/details/88851825

post页面提交来的数据

jsp页面

<%@ page language="java" contentType="text/html; charset=UTF-8"   pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

servlet 层

   request.setCharacterEncoding("utf-8");//
        response.setContentType("text/html;charset=utf-8");//响应编码

get 提交需要反编译


        String name = request.getParameter("cname");           
        byte[] b = name.getBytes("iso-8859-1");
        name = new String(b,"utf-8");
   
 

猜你喜欢

转载自blog.csdn.net/weixin_41957098/article/details/88851825