tomcat 1.7 简汉解码

169 阅读1分钟
private String transStr(String s) {
    String ss = null;
    try {
        ss = new String(s.getBytes("ISO8859-1"), StandardCharsets.UTF_8);
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return ss;
}

<jsp:setProperty name="test" property="key" value='<%= transStr(request.getParameter("key"))%>'/>