コード例 #1
0
  private void confirmStudy6() throws Exception {
    FormProcessor fp = new FormProcessor(request);
    Validator v = new Validator(request);
    v.addValidation(
        "medlineIdentifier",
        Validator.LENGTH_NUMERIC_COMPARISON,
        NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO,
        255);
    v.addValidation(
        "url",
        Validator.LENGTH_NUMERIC_COMPARISON,
        NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO,
        255);
    v.addValidation(
        "urlDescription",
        Validator.LENGTH_NUMERIC_COMPARISON,
        NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO,
        255);

    errors = v.validate();

    StudyBean newStudy = (StudyBean) session.getAttribute("newStudy");
    newStudy.setMedlineIdentifier(fp.getString("medlineIdentifier"));
    newStudy.setResultsReference(fp.getBoolean("resultsReference"));
    newStudy.setUrl(fp.getString("url"));
    newStudy.setUrlDescription(fp.getString("urlDescription"));
    session.setAttribute("newStudy", newStudy);
    // request.setAttribute("interventions",session.getAttribute("interventions"));
    if (errors.isEmpty()) {
      forwardPage(Page.UPDATE_STUDY8);
    } else {
      request.setAttribute("formMessages", errors);
      forwardPage(Page.UPDATE_STUDY7);
    }
  }
コード例 #2
0
  private void validateStudy6(FormProcessor fp, Validator v) {
    v.addValidation(
        "medlineIdentifier",
        Validator.LENGTH_NUMERIC_COMPARISON,
        NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO,
        255);
    v.addValidation(
        "url",
        Validator.LENGTH_NUMERIC_COMPARISON,
        NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO,
        255);
    v.addValidation(
        "urlDescription",
        Validator.LENGTH_NUMERIC_COMPARISON,
        NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO,
        255);

    errors = v.validate();

    study.setMedlineIdentifier(fp.getString("medlineIdentifier"));
    study.setResultsReference(fp.getBoolean("resultsReference"));
    study.setUrl(fp.getString("url"));
    study.setUrlDescription(fp.getString("urlDescription"));
    // request.setAttribute("interventions",session.getAttribute(
    // "interventions"));
    if (!errors.isEmpty()) {
      request.setAttribute("formMessages", errors);
    }
  }