Home >Java >javaTutorial >Write the first app interface in java
This article uses Java to write a simple app interface, which has certain reference value. The most important thing is this process and ideas. Friends who are interested can learn about it. I hope it can be helpful to you.
1 Install MyEclipse. There is no need to configure the Java environment for Android.
2 Configure tomcat
3 Download gson, jar package, add dependencies, and put it under webRoot/web-inf/lib
4 Create web project
5 Write a LoginServlet to integrate httpServlet and rewrite the doPost() and doGet() methods. The code is as follows
Related tutorials:Android video tutorial
6 Modify web.xml as follows
7 Deploy the project to tomcat as follows
8 Open the web page at localhost:8080/repairs/login?name=123&pwd=12.13556 and return the following results
{"result":"1","pwd":"12.13556","name":"123"}, here is the get request.
9 This localhost phone is inaccessible. We use proxy charles. Please download and install the configuration by yourself.
10 Android post request, return data, and you're done.
Related tutorials: Java video tutorial
The above is the detailed content of Write the first app interface in java. For more information, please follow other related articles on the PHP Chinese website!