public static boolean getBooleanParameter(HttpServletRequest request,
            String name, boolean defaultVal)
    {
        String temp = request.getParameter(name);
        if ("true".equals(temp) || "on".equals(temp)) {
            return true;
        }
        else if ("false".equals(temp) || "off".equals(temp)) {
            return false;
        }
        else {
            return defaultVal;
        }
    }
Returns a parameter as a boolean.

@param request the HttpServletRequest object, known as "request" in a
     JSP page.
@param name the name of the parameter you want to get
@param defaultVal the default value if the parameter is not present
@return true if the value of the parameter was "true", false otherwise.
xmppserver/src/main/java/org/jivesoftware/util/ParamUtils.java