android 与 服务器通信

 服务端代码:

(1)control 层

android 与 服务器通信_第1张图片

 /**     * 用户登录     * @return     */    @RequestMapping(value = "/login",method = RequestMethod.POST)    @ResponseBody    public String login(            @RequestParam(value = "userName") String userName,            @RequestParam(value = "userPassword") String userPassword,            HttpSession httpSession){      /*  int result = appUserInfoService.getAddr(request);*/        try{            System.out.println(userName+","+userPassword);            User user = userService.login(userName,userPassword);            if(user == null){                return JSON.toJSONString(-1);//用户名密码错误            }else{                return JSON.toJSONString(user, SerializerFeature.DisableCircularReferenceDetect);//登录成功            }        }catch(Exception e) {            return JSON.toJSONString(0);        }    }

  

 

(2)service  层

android 与 服务器通信_第2张图片

 

 android 与 服务器通信_第3张图片

(3)Dao 层

 

android 与 服务器通信_第4张图片

 

(4)mapping层

android 与 服务器通信_第5张图片

 

参考博客:http://blog.csdn.net/qq_33171970/article/details/54956320

 

更多相关文章

  1. android实现发送Email功能(从相册中选择图片作为附件)
  2. android 在画布上画图片
  3. Activity之间的通信
  4. Android BLE学习(二): Android与51822蓝牙模块通信流程的实现与分析
  5. Android ImageView圆角图片的简单实现
  6. .net + Android 通信

随机推荐

  1. Android(安卓)自定义视图
  2. Mac下关于The "android" command is depr
  3. ArcGIS API For Android离线地图的实现
  4. Android中RecyclerView Adapter的骚操作
  5. 睡眠唤醒机制简介
  6. 《Android和PHP最佳实践》官方站
  7. Android: 打印Bundle内容
  8. Android崩溃后重启
  9. onAttachToWindow() 调用
  10. android实现电话状态监控