一,服务器端:

  首先搭建struts2的环境,导入必要的类库。

android--使用Struts2服务端与android交互

web.xml文件:


struts.xml文件:


Action类:


这个Music实体类,android客户端也用到。


访问 http://localhost:8080/Client/getjson.action;结果:

android--使用Struts2服务端与android交互


二,android客户端:


android--使用Struts2服务端与android交互

Activity类:

     



list.xml


运行结果:

android--使用Struts2服务端与android交互

主要的交互都是通过goolge的Gson完成

相关文章:

  • 2022-12-23
  • 2021-07-11
  • 2021-12-25
  • 2022-12-23
  • 2021-12-17
  • 2021-08-06
  • 2022-12-23
猜你喜欢
  • 2021-11-26
  • 2021-06-19
  • 2021-10-03
  • 2021-12-10
  • 2021-11-19
相关资源
相似解决方案