Examples of reject()


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

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

    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

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

    MockRequestContext context = new MockRequestContext(parameters());

    assertEquals(action.getEventFactorySupport().getSuccessEventId(), action.setupForm(context).getId());

    Errors errors = getErrors(context);
    errors.reject("dummy");
    TestBean formObject = getFormObject(context);
    formObject.setProp("bla");

    // setupForm() should leave the existing form object and Errors instance
    // untouched, at least when no bind & validate is done (bindOnSetupForm
View Full Code Here

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

    MockRequestContext context = new MockRequestContext(parameters());

    assertEquals(action.getEventFactorySupport().getSuccessEventId(), action.setupForm(context).getId());

    Errors errors = getErrors(context);
    errors.reject("dummy");
    TestBean formObject = getFormObject(context);
    formObject.setProp("bla");

    // bindAndValidate() should leave the existing form object untouched
    // but should setup a new Errors instance during bind & validate
View Full Code Here

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

   * http://opensource.atlassian.com/projects/spring/browse/SPR-4005
   */
  public void testOmittedPathMatchesObjectErrorsOnly() throws Exception {
    this.tag.setPath(null);
    Errors errors = new BeanPropertyBindingResult(new TestBean(), "COMMAND_NAME");
    errors.reject("some.code", "object error");
    errors.rejectValue("name", "some.code", "field error");
    exposeBindingResult(errors);
    this.tag.doStartTag();
    assertNotNull(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE));
    this.tag.doEndTag();
View Full Code Here

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

  }

  public void testBindErrorsTagWithErrors() throws JspException {
    PageContext pc = createPageContext();
    Errors errors = new ServletRequestDataBinder(new TestBean(), "tb").getBindingResult();
    errors.reject("test", null, "test");
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", errors);
    BindErrorsTag tag = new BindErrorsTag();
    tag.setPageContext(pc);
    tag.setName("tb");
    assertTrue("Correct doStartTag return value", tag.doStartTag() == Tag.EVAL_BODY_INCLUDE);
View Full Code Here

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

  }

  public void testBindTagWithGlobalErrors() throws JspException {
    PageContext pc = createPageContext();
    Errors errors = new ServletRequestDataBinder(new TestBean(), "tb").getBindingResult();
    errors.reject("code1", "message1");
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", errors);

    BindTag tag = new BindTag();
    tag.setPageContext(pc);
    tag.setPath("tb");
View Full Code Here

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

  }

  public void testBindTagWithGlobalErrorsAndNoDefaultMessage() throws JspException {
    PageContext pc = createPageContext();
    Errors errors = new ServletRequestDataBinder(new TestBean(), "tb").getBindingResult();
    errors.reject("code1");
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", errors);

    BindTag tag = new BindTag();
    tag.setPageContext(pc);
    tag.setPath("tb");
View Full Code Here

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

  }

  public void testBindTagWithGlobalErrorsAndDefaultMessageOnly() throws JspException {
    PageContext pc = createPageContext();
    Errors errors = new ServletRequestDataBinder(new TestBean(), "tb").getBindingResult();
    errors.reject(null, "message1");
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", errors);

    BindTag tag = new BindTag();
    tag.setPageContext(pc);
    tag.setPath("tb");
View Full Code Here

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

  public void testBindStatusGetErrorMessagesAsString() throws JspException {
    // one error (should not include delimiter)
    PageContext pc = createPageContext();
    Errors errors = new ServletRequestDataBinder(new TestBean(), "tb").getBindingResult();
    errors.reject("code1", null, "message1");
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", errors);
    BindTag tag = new BindTag();
    tag.setPageContext(pc);
    tag.setPath("tb");
    tag.doStartTag();
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.