code: public static String getParameter(ServletRequest request, String name) {
      String s = request.getParameter(name);
      if (s == null) {
        return null;
      }
      s = s.trim();
      return s.length() == 0? null: s;
    }
docs: Get a parameter from a ServletRequest.
  Return null if the parameter contains only white spaces.