public ActionForward confirmTrans(final ActionMapping mapping,
final ActionForm actionForm, final HttpServletRequest req,
final HttpServletResponse res) throws Exception {
String str= decodeToUtf(req.getParameter("str"));
return null;
}
public static String decodeToUtf(Object obj) {
String reStr = obj != null ? obj.toString() : "";
String regEx = "[+]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(reStr);
reStr = m.replaceAll("【SPSOFT】+【SPSOFT】");
try {
reStr = URLDecoder.decode(reStr, "UTF-8");
reStr = reStr.replaceAll("【SPSOFT】+【SPSOFT】", "+");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return reStr;
}
var str= encodeURI(str); str= encodeURI(str); var url = path + actionPath + "&str=" + str;
转载于:https://blog.51cto.com/phzg03/1572148