SSM处理接收到的android传来的request请求

@RequestMapping("/adduser.json")
public void  adduserFromClient(HttpServletRequest request, HttpServletResponse response) throws Exception {


    System.out.println(request.getParameter("email"));
    System.out.println(request.getParameter("password"));

    //操作数据库




    response.setContentType("application/json");
    PrintWriter out =null;
    JSONObject jsonObject = new JSONObject();
    try {
        out = response.getWriter();
        jsonObject.put("status", 1);
        out.write(jsonObject.toString());
        System.out.println(jsonObject.toString());
    } catch (Exception e) {
        // TODO: handle exception
    }finally {
        out.flush();
        out.close();
    }

}
@RequestMapping("/usercheck.json")
public void  usercheckFromClient(HttpServletRequest request, HttpServletResponse response) throws Exception {


    System.out.println(request.getParameter("email"));
    System.out.println(request.getParameter("password"));

    //操作数据库




    response.setContentType("application/json");
    PrintWriter out =null;
    JSONObject jsonObject = new JSONObject();
    try {
        out = response.getWriter();
        jsonObject.put("status", 1);
        out.write(jsonObject.toString());
        System.out.println(jsonObject.toString());
    } catch (Exception e) {
        // TODO: handle exception
    }finally {
        out.flush();
        out.close();
    }

}
@RequestMapping("/orderupload.json")
public void  orderuploadFromClient(HttpServletRequest request, HttpServletResponse response) throws Exception {


    String email = new String(request.getParameter("email").getBytes("iso-8859-1"), "utf-8");
    String tname = new String(request.getParameter("tname").getBytes("iso-8859-1"), "utf-8");
    String tphone = new String(request.getParameter("tphone").getBytes("iso-8859-1"), "utf-8");
    String ttime = new String(request.getParameter("ttime").getBytes("iso-8859-1"), "utf-8");
    String taddress = new String(request.getParameter("taddress").getBytes("iso-8859-1"), "utf-8");
    String tclass = new String(request.getParameter("tclass").getBytes("iso-8859-1"), "utf-8");
    String tsigna = new String(request.getParameter("tsigna").getBytes("iso-8859-1"), "utf-8");
    String telse = new String(request.getParameter("telse").getBytes("iso-8859-1"), "utf-8");



    System.out.println(email);
    System.out.println(tname);
    System.out.println(tphone);
    System.out.println(ttime);
    System.out.println(taddress);
    System.out.println(tclass);
    System.out.println(tsigna);
    System.out.println(telse);

    //操作数据库

// String email = intent.getStringExtra(“email”);
// String tname = intent.getStringExtra(“tname”);
// String tphone = intent.getStringExtra(“tphone”);
// String ttime = intent.getStringExtra(“ttime”);
// String taddress = intent.getStringExtra(“taddress”);
// String tclass = intent.getStringExtra(“tclass”);
// String tsigna = intent.getStringExtra(“tsigna”);
// String telse = intent.getStringExtra(“telse”);

    response.setContentType("application/json");
    PrintWriter out =null;
    JSONObject jsonObject = new JSONObject();
    try {
        out = response.getWriter();
        jsonObject.put("status", 1);
        out.write(jsonObject.toString());
        System.out.println(jsonObject.toString());
    } catch (Exception e) {
        // TODO: handle exception
    }finally {
        out.flush();
        out.close();
    }

}
阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/superce/article/details/79962635
个人分类: Android
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭