public static Map<Strinig, String> toMap(String url) { Map<String, String>map = null; if (url != null && url.indexOf("&") > -1 && url.indexOf("=") > -1) { map = new HashMap<String, String>(); String[] arrTemp = url.split("&"); for (String str : arrTemp) { String[] qs = str.split("="); map.put(qs[0], qs[1]); } } return map; }
public static String getQueryString(String url, String name){ return StringUtils.toMap(url).get(name); }
String qs = getQueryString(url, "action");
网友评论