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

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -