コード例 #1
0
  @RequestMapping(value = "/cp/diagnosisType.html", method = RequestMethod.POST)
  public String submitForm(
      @ModelAttribute("diagnosisType") @Valid DiagnosisType diagnosisType,
      BindingResult result,
      SessionStatus status) {

    diagnosisTypeValidator.validate(diagnosisType, result);
    if (result.hasErrors()) {
      return null;
    }

    if (diagnosisType.getId() != null && diagnosisType.getId() > 0)
      prescriptionService.updateDiagnosisType(diagnosisType);
    else prescriptionService.saveDiagnosisType(diagnosisType);

    status.setComplete();
    return "redirect:/cp/diagnosisTypeList.html";
  }