How I can send json response from my spring controller?

前端 未结 2 918
长发绾君心
长发绾君心 2021-01-17 04:44

I\'m a newbie in the theme. How can I return JSON data from my controller, using something like that (using ResponseBody)

@RequestMapping(value = \"/ajaxtest         


        
2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-17 05:38

    For Converting to json request you must include following 3 jar to your project build path. Jackson jar is use for convrting HTTP request to jason format.

    Also mention headear=content-type=application/json

    These are the jar files

    jackson-mapper-asl.jar
    jackson-core-asl.jar
    jackson-jaxrs.jar
    

提交回复
热议问题