Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6124141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:05:56+00:00 2026-05-23T16:05:56+00:00

i want to send json to server using Spring 3.x, i use annotation @RequestBody,

  • 0

i want to send json to server using Spring 3.x, i use annotation @RequestBody, but my controller don’t called.

Please, send me a complete example, if any, I’m trying to use example in
http://blog.springsource.com/2010/01/25/ajax-simplifications-in-spring-3-0/ but it doesn’t work. Here is a javascript code

function sendAjax() {
var person = new Object();
person.firstname = "Firsname";
person.lastname = "Lastname";

jQuery.ajax({ 
    url: "person", 
    type: 'POST', 
    dataType: 'json', 
    data: person, 
    contentType: 'application/json', 
    success: function(data) { 
        alert(data.firstname + " " + data.lastname);
    } 
});}

And my controller is

@Controller public class AjaxController {

@RequestMapping(value="person", method = RequestMethod.POST)
public @ResponseBody Person getRequest(@RequestBody Person person) {        
    System.out.println(person.getFirstname() + " " + person.getLastname());
    return new Person("Return", "Body");
}}

my xml file

<mvc:annotation-driven />               
<context:component-scan base-package="com.synisys.spring.test.controllers" />
<context:annotation-config/> 

 <mvc:resources mapping="/js/**" location="/js/"/>

  <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix">
            <value>/WEB-INF/pages/</value>
        </property>
        <property name="suffix">
            <value>.jsp</value>
        </property>
    </bean>

<bean id="jacksonMessageConverter"
    class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"></bean>
<bean
    class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
    <property name="messageConverters">
        <list>
            <ref bean="jacksonMessageConverter" />
        </list>
    </property>
</bean>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:05:57+00:00Added an answer on May 23, 2026 at 4:05 pm

    Please make sure you have

     <context:annotation-config/> 
    

    and also

    <bean id="jacksonMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"></bean>
     <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
    <property name="messageConverters">
      <list>
        <ref bean="jacksonMessageConverter"/>
      </list>
    </property>
    </bean>
    

    In your spring xml conf file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to send my data in form of json to server using post
I have following json data which I want to pass it to server using
I want so send every week an update by email. But Im afraid that
I am sending a json string from my iphone application to server using ASIFormDataRequest.
I've to send a file to my server using jQuery. How can I do
I'm using spring MVC for receiving a JSON from client and automatically create an
For testing purposes I want send mail to my localhost user account rather than
Want to send the text from my current vb application to the Active Window
I want to send email from a Ruby application. Is there a call in
I want to send an array constructed in javascript with the selected values of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.