Ejemplo n.º 1
0
  /** Validates Input data */
  @Override
  protected boolean validate(HttpServletRequest request) {

    log.debug("UserCtl Method validate Started");

    boolean pass = true;

    String login = request.getParameter("login");
    String dob = request.getParameter("dob");

    if (DataValidator.isNull(request.getParameter("firstName"))) {
      request.setAttribute("firstName", PropertyReader.getValue("error.require", "First Name"));
      pass = false;
    }

    if (DataValidator.isNull(request.getParameter("lastName"))) {
      request.setAttribute("lastName", PropertyReader.getValue("error.require", "Last Name"));
      pass = false;
    }

    if (DataValidator.isNull(login)) {
      request.setAttribute("login", PropertyReader.getValue("error.require", "Login Id"));
      pass = false;
    } else if (!DataValidator.isEmail(login)) {
      request.setAttribute("login", PropertyReader.getValue("error.email", "Login "));
      pass = false;
    }

    if (DataValidator.isNull(request.getParameter("password"))) {
      request.setAttribute("password", PropertyReader.getValue("error.require", "Password"));
      pass = false;
    }

    if (DataValidator.isNull(request.getParameter("confirmPassword"))) {
      request.setAttribute(
          "confirmPassword", PropertyReader.getValue("error.require", "Confirm Password"));
      pass = false;
    }

    if (DataValidator.isNull(request.getParameter("gender"))) {
      request.setAttribute("gender", PropertyReader.getValue("error.require", "Gender"));
      pass = false;
    }
    if (DataValidator.isNull(dob)) {
      request.setAttribute("dob", PropertyReader.getValue("error.require", "Date Of Birth"));
      pass = false;
    } else if (!DataValidator.isDate(dob)) {
      request.setAttribute("dob", PropertyReader.getValue("error.date", "Date Of Birth"));
      pass = false;
    }
    if (!request.getParameter("password").equals(request.getParameter("confirmPassword"))
        && !"".equals(request.getParameter("confirmPassword"))) {
      ServletUtility.setErrorMessage("Confirm  Password  should not be matched.", request);
      pass = false;
    }

    log.debug("UserCtl Method validate Ended");

    return pass;
  }
Ejemplo n.º 2
0
  /** Validates Input data */
  @Override
  protected boolean validate(HttpServletRequest request) {

    log.debug("CollegeCtl Method validate Started");

    boolean pass = true;
    String emailId = request.getParameter("emailId");

    if (DataValidator.isNull(request.getParameter("companyname"))) {
      request.setAttribute("companyname", PropertyReader.getValue("error.require", "companyname"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("industryId"))) {
      request.setAttribute("industryId", PropertyReader.getValue("error.require", "industryId"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("village"))) {
      request.setAttribute("village", PropertyReader.getValue("error.require", "village"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("country"))) {
      request.setAttribute("country", PropertyReader.getValue("error.require", "country"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("state"))) {
      request.setAttribute("state", PropertyReader.getValue("error.require", "state"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("district"))) {
      request.setAttribute("district", PropertyReader.getValue("error.require", "district"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("city"))) {
      request.setAttribute("city", PropertyReader.getValue("error.require", "city"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("area"))) {
      request.setAttribute("area", PropertyReader.getValue("error.require", "Area"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("postOffice"))) {
      request.setAttribute("postOffice", PropertyReader.getValue("error.require", "Post Office"));
      pass = false;
    }

    if (DataValidator.isNull(request.getParameter("stdCodePhoneNoOne"))) {
      request.setAttribute(
          "stdCodePhoneNoOne", PropertyReader.getValue("error.require", "STD Code"));
      pass = false;
    }
    if (!DataValidator.isNumber(request.getParameter("stdCodePhoneNoOne"))) {
      request.setAttribute(
          "stdCodePhoneNoOne", PropertyReader.getValue("error.number", "STD Code"));
      pass = false;
    }

    if (DataValidator.isNull(request.getParameter("phoneNoOne"))) {
      request.setAttribute("phoneNoOne", PropertyReader.getValue("error.require", "Phone No"));
      pass = false;
    }
    if (!DataValidator.isNumber(request.getParameter("phoneNoOne"))) {
      request.setAttribute("phoneNoOne", PropertyReader.getValue("error.number", "Phone No"));
      pass = false;
    }

    if (DataValidator.isNull(request.getParameter("orgEmailIdOne"))) {
      request.setAttribute("orgEmailIdOne", PropertyReader.getValue("error.require", "Email Id"));
      pass = false;
    } else if (!DataValidator.isEmail(request.getParameter("orgEmailIdOne"))) {
      request.setAttribute("orgEmailIdOne", PropertyReader.getValue("error.email", "Email Id"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("ownerName"))) {
      request.setAttribute("ownerName", PropertyReader.getValue("error.require", "Name of Owner"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("ownerAddress"))) {
      request.setAttribute("ownerAddress", PropertyReader.getValue("error.require", "Address"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("ownerCountryId"))) {
      request.setAttribute("ownerCountryId", PropertyReader.getValue("error.require", "Country"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("ownerStateId"))) {
      request.setAttribute("ownerStateId", PropertyReader.getValue("error.require", "State"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("ownerDistrictId"))) {
      request.setAttribute("ownerDistrictId", PropertyReader.getValue("error.require", "District"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("ownerCityId"))) {
      request.setAttribute("ownerCityId", PropertyReader.getValue("error.require", "City"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("ownerAreaId"))) {
      request.setAttribute("ownerAreaId", PropertyReader.getValue("error.require", "Area"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("ownerPostOfficeId"))) {
      request.setAttribute(
          "ownerPostOfficeId", PropertyReader.getValue("error.require", "Post Office"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("ownerPINCode"))) {
      request.setAttribute("ownerPINCode", PropertyReader.getValue("error.require", "Pin Code"));
      pass = false;
    }

    if (DataValidator.isNull(request.getParameter("ownerMobileNo"))) {
      request.setAttribute("ownerMobileNo", PropertyReader.getValue("error.require", "Mobile No"));
      pass = false;
    }
    if (!DataValidator.isNumber(request.getParameter("ownerMobileNo"))) {
      request.setAttribute("ownerMobileNo", PropertyReader.getValue("error.number", "Mobile No"));
      pass = false;
    }
    if (!DataValidator.isNumberLenth(request.getParameter("ownerMobileNo"))) {
      request.setAttribute("ownerMobileNo", PropertyReader.getValue("error.length", "Mobile No"));
      pass = false;
    }

    if (DataValidator.isNull(request.getParameter("ownerEmail"))) {
      request.setAttribute("ownerEmail", PropertyReader.getValue("error.require", "Email Id"));
      pass = false;
    } else if (!DataValidator.isEmail(request.getParameter("ownerEmail"))) {
      request.setAttribute("ownerEmail", PropertyReader.getValue("error.email", "Email Id"));
      pass = false;
    }
    if (DataValidator.isNull(request.getParameter("contactPersonName"))) {
      request.setAttribute("contactPersonName", PropertyReader.getValue("error.require", "Name"));
      pass = false;
    }

    if (DataValidator.isNull(request.getParameter("contactPersonMobileNo"))) {
      request.setAttribute(
          "contactPersonMobileNo",
          PropertyReader.getValue("error.require", "Contact Person Mobile No"));
      pass = false;
    }
    if (!DataValidator.isNumber(request.getParameter("contactPersonMobileNo"))) {
      request.setAttribute(
          "contactPersonMobileNo",
          PropertyReader.getValue("error.number", "Contact Person Mobile No"));
      pass = false;
    }
    if (!DataValidator.isNumberLenth(request.getParameter("contactPersonMobileNo"))) {
      request.setAttribute(
          "contactPersonMobileNo",
          PropertyReader.getValue("error.length", "Contact Person Mobile No"));
      pass = false;
    }

    if (DataValidator.isNull(request.getParameter("contactPersonEmail"))) {
      request.setAttribute(
          "contactPersonEmail", PropertyReader.getValue("error.require", "Email Id"));
      pass = false;
    } else if (!DataValidator.isEmail(request.getParameter("contactPersonEmail"))) {
      request.setAttribute(
          "contactPersonEmail", PropertyReader.getValue("error.email", "Email Id"));
      pass = false;
    }

    log.debug("CollegeCtl Method validate Ended");

    return pass;
  }