Recently, there is a project need to use the JSON transfer, not too understanding, in the Internet to find some relevant information, wrote a small demo, you can achieve the basic function: The Android client sends JSON to the server, the server uses the JSP to receive, parse and return to the client in JSON form, The client receives printing, first look at the effect of the operation, the source code will be given at the end of the article.
1. Server: After receiving the JSON to resolve the print, and then send the JSON to the client
2. Client, receive the JSON returned by the server after printing
Simple introduction of the following source:
The service side uses json.jsp to receive parsing the client passes the Json,json resolution needs to use the Lib directory the jar package, needs to use the Tomcat to run, the source directory structure is as follows:
The client is very simple, all in the mainactivity implementation, the source directory structure is as follows:
Source download point here ^ ^