javascript - 通过a标签href属性跳转后台乱码问题

查看:333
本文介绍了javascript - 通过a标签href属性跳转后台乱码问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

通过a标签href属性跳转后台乱码问题,试过request.setCharacterEncoding("UTF-8");设置,没有用。

页面代码

<div class="extra">
    <a target="_blank" href="Qtitle/findTypeTitle?title_type=${qtype.title_type}">查看更多>></a>
</div>

后台代码

@RequestMapping("/findTypeTitle")
public String findTypeTitle(Model model,String title_type) throws UnsupportedEncodingException{
    request.setCharacterEncoding("UTF-8");
    //response.setContentType("text/html; charset=utf-8");//也实现不了
    System.out.println(request.getParameter("title_type"));//输出
    qtListType3=qtbiz.findTypeTitle(request.getParameter("title_type"));

    request.getSession().setAttribute("qtListType3", qtListType3);

    
    return "problem-more";
    
}

想问问还有没有其他方法实现,解决乱码问题

解决方案

title_type包含中文吗?
参考【WEB】url路径包含中文和表单get请求包含中文

这篇关于javascript - 通过a标签href属性跳转后台乱码问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆