我生气了这个:
使用JDK 1.7的Tomcat 5.5,JRE 1.6(合规级别)
接头:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
...
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script src="js/jquery-ui/jquery-1.9.0.js"></script>
Json请求:
params = $("#formList").serializeArray();
$.getJSON(url, params, function(data) {...});
当我传递一个ñ到alias参数时,在我的localhost机器上(win)工作正常,但是在生产服务器(linux)中我得到了param或类似东西的双重编码:
WebBrowserRequest(对localhost&amp; production的请求相同):
userList.action pagination.currentPage = 1&安培; pagination.sortColumn =安培; pagination.sortColumnOrder =安培;的 user.alias =%C3%B1 &安培; user.email =安培; selectedRole = -1&安培; = SELECTEDCOUNTRY -1安培; selectedTown = -1&安培; selectedLanguage = -1&安培; selectedUserEnabled = 0&安培; __ multiselect_selectedCategories =安培; jsonRequest =真安培;背面=假
服务器端网址输出(localhost):
userList.action pagination.currentPage = 1&安培; jsonRequest =真安培; user.email =安培; selectedLanguage = -1&安培; selectedTown = -1&安培; SELECTEDCOUNTRY = -1&安培; pagination.sortColumn =安培; selectedRole = -1&安培;回=假安培;的 user.alias = A±&安培; selectedUserEnabled = 0&安培; pagination.sortColumnOrder =安培; __ multiselect_selectedCategories =
服务器端网址输出(生产):
userList.action jsonRequest =真安培; selectedTown = -1&安培; pagination.sortColumn =安培;的 user.alias = AA±&安培;背面=假安培; pagination.sortColumnOrder =安培; pagination.currentPage = 1&安培; user.email =安培; selectedLanguage = -1&安培; = SELECTEDCOUNTRY -1安培; selectedRole = -1&安培; selectedUserEnabled = 0&安培; __ multiselect_selectedCategories =
答案 0 :(得分:0)
最后通过$ .ajax(POST)解决了更改getJSON(GET)请求的问题:
的getJSON:
$.getJSON(url, params, function(data) {
showData(data);
}).error(function(data) {
showFail(data);
});
AJAX:
$.ajax({
type: "POST",
url: url,
data: params
}).done(function( data ) {
showData(data,page);
}).fail(function(jqXHR, textStatus) {
showFail(jqXHR, textStatus);
});