Example usage for org.springframework.validation BindingResult hasErrors

List of usage examples for org.springframework.validation BindingResult hasErrors

Introduction

In this page you can find the example usage for org.springframework.validation BindingResult hasErrors.

Prototype

boolean hasErrors();

Source Link

Document

Return if there were any errors.

Usage

From source file:controller.makeAppointment.java

@RequestMapping(method = RequestMethod.POST)
public String save(@ModelAttribute("makeAppointment") @Valid Appointment1 appointment, BindingResult result) {
    if (result.hasErrors()) {
        return "makeAppointment";
    }/*from   w w  w  .  j a v  a  2s .co m*/
    service.makeAppointment(appointment);
    return "confirmApp";
}

From source file:org.terasoluna.gfw.functionaltest.app.codepoints.ConsistOfCheckController.java

@RequestMapping(value = "consistOfCheck", method = RequestMethod.POST)
public String consistOfCheck(@Validated ConsistOfCheckForm form, BindingResult result) {

    if (result.hasErrors()) {
        return consistOfCheck_form();
    }/*  w  w w . j a  va  2 s .co  m*/

    return "codepoints/result_consistOfCheck";
}

From source file:controller.MakeAgenda.java

@RequestMapping(method = RequestMethod.POST)
public String save(Model model, @ModelAttribute("appointment") @Valid Agenda agenda, BindingResult result) {
    if (result.hasErrors()) {
        return "makeAgenda";
    }/* ww  w. j  a  v a  2s. c om*/
    List<Appointment1> results = service.makeAgenda(agenda.getDoctor(), agenda.getDate());
    model.addAttribute("results", results);
    model.addAttribute("appointment", agenda);
    return "Agenda";
}

From source file:de.dentrassi.osgiee.web4.FormController.java

@RequestMapping(method = RequestMethod.POST)
public ModelAndView process(@Valid @ModelAttribute("command") final FormData data, final BindingResult result) {
    if (result.hasErrors()) {
        final Map<String, Object> model = new HashMap<>();
        model.put("command", data);

        return new ModelAndView("form");
    } else {/*  w  w  w . j a  v a 2  s  .  c o  m*/
        return new ModelAndView("success");
    }
}

From source file:AgendaSpringH.controladores.Controlador.java

@RequestMapping(method = RequestMethod.POST)
public String processValidatinForm(@Valid ValidationForm validationForm, BindingResult result, Map model) {
    if (result.hasErrors()) {
        return "validationform";
    }/*from  w ww .  ja  v a 2s  .  c  o  m*/
    // Add the saved validationForm to the model
    model.put("validationForm", validationForm);
    return "validationsuccess";
}

From source file:com.github.britter.springbootherokudemo.HomeController.java

@RequestMapping(method = RequestMethod.POST)
public String insertData(ModelMap model, @ModelAttribute("insertRecord") @Valid Record record,
        BindingResult result) {
    if (!result.hasErrors()) {
        repository.save(record);//  w w  w  . j a va  2  s. c  o  m
    }
    return home(model);
}

From source file:technology.tikal.accounts.service.imp.LoginServiceImp.java

@Override
@RequestMapping(produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)//  w  w w.  j  ava 2 s.com
public SessionInfo login(@Valid @RequestBody AuthenticationRequest request, BindingResult result) {
    if (result.hasErrors()) {
        throw new NotValidException(result);
    }
    return accountsController.createSession(request);
}

From source file:info.michaelchurch.arule.controllers.ContactController.java

@RequestMapping(method = RequestMethod.POST)
public String Process(Model model, @Valid Comment comment, BindingResult result) {

    if (result.hasErrors()) {
        return "contact";
    }//from  w ww .  j  a v  a2s.c o  m

    if (contactProcessor.process(comment)) {
        model.addAttribute("verdict", "Success");
    } else {
        model.addAttribute("verdict", "Failure");
    }
    return "contact";
}

From source file:technology.tikal.accounts.service.imp.AccountsConfigImp.java

@Override
@RequestMapping(value = "/session/rest", method = RequestMethod.POST)
public void setSessionRestConfig(@Valid @RequestBody SessionDaoRestConfig config, BindingResult result) {
    if (result.hasErrors()) {
        throw new NotValidException(result);
    }/*from  w  w  w.  j av  a  2  s .co m*/
    sessionController.setRemoteSessionConfig(config);
}

From source file:technology.tikal.accounts.service.imp.AccountsConfigImp.java

@Override
@RequestMapping(value = "/session/authority", method = RequestMethod.POST)
public void setSessionAuthorityConfig(@Valid @RequestBody RoleAuthorityMapEntry config, BindingResult result) {
    if (result.hasErrors()) {
        throw new NotValidException(result);
    }/*  w w w .ja v  a 2s  . c om*/
    sessionController.setAuthorityConfig(config);
}