后台数据传到前台乱码

系统管理员 2023-06-16 01:55 34阅读 0赞

1.查看页面是否填写 meta属性和页面属性脚本

  1. pageEncoding="UTF-8" isELIgnored="false"%>
  2. <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge"> <%-- IE运行最新的渲染模式 --%>
  8. <meta name="viewport" content="width=device-width, initial-scale=1"> <%-- 初始化移动浏览显示 --%>

2.在controller层添加

  1. /** * 添加修改角色 * @return */
  2. @ResponseBody
  3. @RequestMapping(value="/edit",produces = { "application/text;charset=UTF-8"})//加此中文乱码解除
  4. public String edit(@Param("rid") String rid) throws Exception {

发表评论

表情:
评论列表 (有 0 条评论,34人围观)

还没有评论,来说两句吧...

相关阅读