1.在jsp页面上添加meta属性
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8" isELIgnored="false"%><%@taglib uri="/jsp/jstl/core" prefix="c"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"> <%-- 在IE运行最新的渲染模式 --%><meta name="viewport" content="width=device-width, initial-scale=1"> <%-- 初始化移动浏览显示 --%>
2.在controller层添加
/*** 添加修改角色* @return*/@ResponseBody@RequestMapping(value="/edit",produces = {"application/text;charset=UTF-8"})//加此中文乱码解除public String edit(@Param("rid") String rid) throws Exception {