Package org.springframework.validation

Examples of org.springframework.validation.BindException.reject()


   */
  protected ModelAndView disallowDuplicateFormSubmission(HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    BindException errors = getErrorsForNewForm(request);
    errors.reject("duplicateFormSubmission", "Duplicate form submission");
    return showForm(request, response, errors);
  }

}
View Full Code Here


   */
  protected ModelAndView disallowDuplicateFormSubmission(HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    BindException errors = getErrorsForNewForm(request);
    errors.reject("duplicateFormSubmission", "Duplicate form submission");
    return showForm(request, response, errors);
  }

}
View Full Code Here

    public boolean removeFromOrganisaties(Organisatie element) {
        for (CasusOverleg overleg : element.getOverleggen()) {
            if (overleg.getDatum().isAfterNow()) {
                BindException errors = new BindException(this, ClassUtils
                        .getShortNameAsProperty(this.getClass()));
                errors.reject("organisatie.casusoverleg.toekomst", new Object[] { element },
                        "organisatie mag niet worden verwijderd als er"
                                + " nog casusoverleggen gevoerd zullen worden in de toekomst");
                throw new BusinessRuleException(errors);
            }
        }
View Full Code Here

  }

  @Test
  public void testModelAndView() throws Exception {
    BindException bindException = new BindException(new Object(), "target");
    bindException.reject("errorCode");

    ModelAndView mav = new ModelAndView("viewName");
    mav.addObject("attrName", "attrValue");
    mav.addObject(BindingResult.MODEL_KEY_PREFIX + "attrName", bindException);
View Full Code Here

  }

  @Test
  public void testModelAndView() throws Exception {
    BindException bindException = new BindException(new Object(), "target");
    bindException.reject("errorCode");

    ModelAndView mav = new ModelAndView("viewName");
    mav.addObject("attrName", "attrValue");
    mav.addObject(BindingResult.MODEL_KEY_PREFIX + "attrName", bindException);
View Full Code Here

  }

  @Test
  public void testErrorsJsonView() throws Exception {
    BindException errors = new BindException(new Object(), "baseUrl");
    errors.reject("no.resources", "No Resources");
    model.put("errors", errors);
    model.put("baseUrl", "http://localhost:8080/springsource");
    standard.render(model, request, response);
    String content = response.getContentAsString();
    // System.err.println(content);
View Full Code Here

  }

  @Test
  public void testErrorsJsonView() throws Exception {
    BindException errors = new BindException(new Object(), "baseUrl");
    errors.reject("foo", "Foo");
    model.put("errors", errors);
    model.put("baseUrl", "http://localhost:8080/springsource");
    standard.render(model, request, response);
    String content = response.getContentAsString();
    // System.err.println(content);
View Full Code Here

  @Test
  public void testEmptyFile() throws Exception {
    Date date = new Date();
    model.put("date", date);
    BindException errors = new BindException(date, "date");
    errors.reject("foo", "Foo");
    model.put(BindingResult.MODEL_KEY_PREFIX+"date", errors);
    view.render(model, request, response);
    String content = response.getContentAsString();
    // System.err.println(content);
    assertTrue(content.contains("<span class=\"error\">Foo</span>"));
View Full Code Here

  @Test
  public void testViewWithNoSuchJob() throws Exception {
    BindException errors = new BindException(new Object(), "launchRequest");
    model.put("errors", errors);
    errors.reject("no.such.job", "No such Job");
    model.put("baseUrl", "http://localhost:8080/springsource");
    job.render(model, request, response);
    String content = response.getContentAsString();
    // System.err.println(content);
    JsonWrapper wrapper = new JsonWrapper(content);
View Full Code Here

  @Test
  public void testViewWithLaunchErrors() throws Exception {
    model.put("job", new JobInfo("foo", 1));
    BindException errors = new BindException(new Object(), "launchRequest");
    model.put("errors", errors);
    errors.reject("job.already.complete", "Already complete");
    model.put("baseUrl", "http://localhost:8080/springsource");
    job.render(model, request, response);
    String content = response.getContentAsString();
    // System.err.println(content);
    JsonWrapper wrapper = new JsonWrapper(content);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.