2
我有一個jQuery的Ajax請求的servlet中的servlet doPut的request.getParameter
$('#updateUser').live('click', function() {
var euserId = editeduserId;
var pname = $('#euname').val();
var psurname = $('#eusurname').val();
var plogin = $('#eulogin').val();
var ppassword = $('#eupassword').val();
var pemail = $('#euemail').val();
var user = {name: pname,
surname: psurname,
login: plogin,
password: ppassword,
email: pemail};
$.ajax({
url: '/SimpleAjaxShit/UserController/' + euserId,
type: 'PUT',
data: user,
success: function(data) {
console.log(data);
},
error: function(data, response) {
console.log(data);
console.log(response);
}
});
$("#dialog-modal").dialog("close");
});
和doPut方法,該方法提供Ajax請求
protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String name = request.getParameter("name"); //Null
String surname = request.getParameter("surname"); //Null
String login = request.getParameter("login"); //Null
String password = request.getParameter("password"); //Null
String email = request.getParameter("email"); //Null
}
我可以看到我在PARAMS頭, 但請求。 getParameter(「名稱」)和其他返回空