首頁  >  問答  >  主體

javascript - 透過a標籤href屬性跳轉後台亂碼問題

透過a標籤href屬性跳轉後台亂碼問題,試過request.setCharacterEncoding("UTF-8");設定,沒有用。

頁面程式碼

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

後台程式碼

@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";
    
}

想問還有沒有其他方法實作,解決亂碼問題

滿天的星座滿天的星座2686 天前836

全部回覆(2)我來回復

  • 女神的闺蜜爱上我

    女神的闺蜜爱上我2017-06-12 09:21:51

    title_type包含中文嗎?
    參考【WEB】url路徑包含中文和表單get請求包含中文

    回覆
    0
  • 阿神

    阿神2017-06-12 09:21:51

    需要對 中文進行轉碼

    回覆
    0
  • 取消回覆