code: public static String getParameter (HttpServletRequest req, String name, boolean returnNull)
      {
          String value = req.getParameter(name);
          if (value == null) {
              return returnNull ? null : "";
          } else {
              return value.trim();
          }
      }
docs: Fetches the supplied parameter from the request. If the parameter does not exist, either
  null or the empty string will be returned depending on the value of the
  <code>returnNull</code> parameter.