1.首先搭建服务器端。
使用MyEclipse开发工具
public class MyServlet extends HttpServlet {@Overrideprotected void doGet(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException {ArrayList
public class Food implements Serializable{private int id;private String name;private String desc;private String imgPath;public Food(int id, String name, String desc, String imgPath) {super;this.id = id;this.name = name;this.desc = desc;this.imgPath = imgPath;}public int getId {return id;}public void setId(int id) {this.id = id;}public String getName {return name;}public void setName(String name) {this.name = name;}public String getDesc {return desc;}public void setDesc(String desc) {this.desc = desc;}public String getImgPath {return imgPath;}public void setImgPath(String imgPath) {this.imgPath = imgPath;}}我们在浏览器中访问
可以获取到结果,说明服务器端是正常的。
2.服务器端搭建好了之后,我们搭建android端