ajax - Does Spring Form Backing support takes null as a value of an entity -
i have entity user[userid, name , age]
now jsp hitting ajax this:
$.ajax({ type: "post", url: "/user/saveuser.htm", data: "userid=" + userid+ "&name=" + name + "&age=" + age, success: function (response) { alert("success"); }
and controller is:
@responsebody @requestmapping(value = {"saveuser"}, method = {requestmethod.post}) public string submitproblem(httpservletrequest req, user user) { //backend codes }
my question when sending name="abc" , age="24" , id=32; fine. "the request sent client syntactically incorrect." response comes if sending id=null.
please me know issue.
try use json data in ajax request first can use
$.ajax({ type: "post", url: "/user/saveuser.htm", data: {'userid': userid, 'name': name, 'age' : age}, success: function (response) { alert("success"); }
and try use corectly spring cant ive never use spring error type of id
if convert id on string maybe work because age work try
userid = userid.tostring(); $.ajax({ type: "post", url: "/user/saveuser.htm", data: "userid=" + userid+ "&name=" + name + "&age=" + age, success: function (response) { alert("success"); }
Comments
Post a Comment