• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

The request sent by the client was syntactically incorrect

 
Greenhorn
Posts: 11
jQuery Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have this javascript code:

this code is to send some text to save in the database and I send it via ajax call as demonstrated this js code goes to controller method below:



as you can see I am using spring 3.0 with annotations
my problem is that every time I fire the js code it gives me : error 400- The request sent by the client was syntactically incorrect
and I don't know any clue so I need help
Regards,
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While this might not solve your problem, one thing I see.

You are using @RequestParam as if those values are directly in the URL string as request parameters. So after the URL part you would have to have ?userName=someValue&message=MessageValue for @RequestParam to get those values. If those values aren't in the URL after the ? then they aren't Request Params.

Where is that data? Is it in the RequestBody? Is it a ModelAttribute? If so , then use its corresponding annotation, @RequestBody or @ModelAttribute

I think it is a combination of the message being sent Message meaning URL and contents, not your variable message. And also in the Controller annotations that you are using are incorrect.

Mark
reply
    Bookmark Topic Watch Topic
  • New Topic