working with Query String in GWT

前端 未结 4 823
闹比i
闹比i 2021-01-13 06:23

I have to created a dynamic URLcontaining the user id and email parameters, which will direct to sign up form in my GWT application. I want to set and get the parameters in

4条回答
  •  日久生厌
    2021-01-13 06:36

    If you want really want to parse the history token (hash part) to encode parameters, here's the code for that:

    private static Map buildHashParameterMap() {
        final String historyToken = History.getToken();
        Map paramMap = new HashMap();
        if (historyToken != null && historyToken.length() > 1) {
            for (String kvPair : historyToken.split("&")) {
                String[] kv = kvPair.split("=", 2);
                if (kv.length > 1) {
                    paramMap.put(kv[0], URL.decodeQueryString(kv[1]));
                } else {
                    paramMap.put(kv[0], "");
                }
            }
        }
    
        return paramMap;
    }
    

提交回复
热议问题