简体   繁体   中英

How do I pass int arguments in RequestParams?

I am trying to use int arguments (matchID, typeID and live) in params, but they seem to be missing from the final query string obtained with params.toString(). What am I missing here?

        RequestParams params = new RequestParams();

        String email = user.getEmail();
        params.put("email", email);
        params.put("password", user.getPassword());
        params.put("token", TextUtil.getToken(email));
        params.put("live", live);
        params.put("matchID", matchID);
        params.put("typeID", typeID);
        params.put("quote", quote);
        params.put("comment", comment);

        System.out.println("matchID: " + matchID); // matchID: 1
        System.out.println("typeID: " + typeID); // typeID : 2
        System.out.println("params: " + params.toString()); // params: quote=2&token=XXX&comment=&email=mail@mail.com&password=mypw

Problem fixed. put only allows String values. Casting the integer values to Strings worked fine.

        params.put("live", String.valueOf(live));
        params.put("matchID", String.valueOf(matchID));
        params.put("typeID", String.valueOf(typeID));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM