简体   繁体   English

如何通过JSP和Servlet将android应用程序与mysql数据库通信

[英]how to communicate android application to mysql database through JSP and Servlet

I am creating an android application and I want that when user fill up the registration form in my android application then that data should be saved in remote MySQL database.But i want JSP and Servlet for this as middle level. 我正在创建一个android应用程序,我希望当用户在我的android应用程序中填写注册表时,该数据应保存在远程MySQL数据库中。但是我希望将此作为中间级别的JSP和Servlet。 I searched a lot on internet but every tutorial shown on internet are using PHP. 我在互联网上进行了大量搜索,但是互联网上显示的每个教程都使用PHP。 I don't want to use PHP at server side. 我不想在服务器端使用PHP。 So is there any tutorial or resource for saving android application data to remote MySQL database using JSP and Servlet. 因此,有没有使用JSP和Servlet将android应用程序数据保存到远程MySQL数据库的教程或资源。

You usually call RESTful services from the Android App. 通常,您可以从Android应用程序调用RESTful服务。 The RESTful services can be written in any language of your choice. RESTful服务可以用您选择的任何语言编写。 Your Android client is one which is communicating with the REST Backend. 您的Android客户端就是与REST后端通信的客户端。 If you are using ButtonView and on the click of it some update or retrieval are supposed to be performed then REST based services are best. 如果您正在使用ButtonView并单击它,则应该执行一些更新或检索,那么基于REST的服务是最好的。 I would recommend this approach. 我会推荐这种方法。

Look at the way servlet is deployed from the below blog : 从下面的博客中查看servlet的部署方式:

http://hmkcode.com/java-servlet-send-receive-json-using-jquery-ajax/ http://hmkcode.com/java-servlet-send-receive-json-using-jquery-ajax/

Hit the servlet URL in a browser.If u get the JSON response, the same call can be leveraged from the mobile client building the URLconnection and rendered in the app using some Parser at Mobile end. 在浏览器中单击servlet URL。如果您获得JSON响应,则可以从移动客户端构建URL连接来利用相同的调用,并使用Mobile端的某些解析器在应用程序中呈现该调用。 Hope this meets the requirement. 希望这符合要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM