Examples of rejectValue()


Examples of org.springframework.validation.BeanPropertyBindingResult.rejectValue()

  public void testWithErrorsAndCustomElement() throws Exception {
    // construct an errors instance of the tag
    TestBean target = new TestBean();
    target.setName("Rob Harrop");
    Errors errors = new BeanPropertyBindingResult(target, COMMAND_NAME);
    errors.rejectValue("name", "some.code", "Default Message");
    errors.rejectValue("name", "too.short", "Too Short");

    exposeBindingResult(errors);

    this.tag.setElement("div");
View Full Code Here

Examples of org.springframework.validation.BeanPropertyBindingResult.rejectValue()

    // construct an errors instance of the tag
    TestBean target = new TestBean();
    target.setName("Rob Harrop");
    Errors errors = new BeanPropertyBindingResult(target, COMMAND_NAME);
    errors.rejectValue("name", "some.code", "Default Message");
    errors.rejectValue("name", "too.short", "Too Short");

    exposeBindingResult(errors);

    this.tag.setElement("div");
    int result = this.tag.doStartTag();
View Full Code Here

Examples of org.springframework.validation.BeanPropertyBindingResult.rejectValue()

    assertEquals(0, output.length());
  }

  public void testAsBodyTag() throws Exception {
    Errors errors = new BeanPropertyBindingResult(new TestBean(), "COMMAND_NAME");
    errors.rejectValue("name", "some.code", "Default Message");
    errors.rejectValue("name", "too.short", "Too Short");
    exposeBindingResult(errors);
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    assertNotNull(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE));
View Full Code Here

Examples of org.springframework.validation.BeanPropertyBindingResult.rejectValue()

  }

  public void testAsBodyTag() throws Exception {
    Errors errors = new BeanPropertyBindingResult(new TestBean(), "COMMAND_NAME");
    errors.rejectValue("name", "some.code", "Default Message");
    errors.rejectValue("name", "too.short", "Too Short");
    exposeBindingResult(errors);
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    assertNotNull(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE));
    String bodyContent = "Foo";
View Full Code Here

Examples of org.springframework.validation.BeanPropertyBindingResult.rejectValue()

  public void testAsBodyTagWithExistingMessagesAttribute() throws Exception {
    String existingAttribute = "something";
    getPageContext().setAttribute(ErrorsTag.MESSAGES_ATTRIBUTE, existingAttribute);
    Errors errors = new BeanPropertyBindingResult(new TestBean(), "COMMAND_NAME");
    errors.rejectValue("name", "some.code", "Default Message");
    errors.rejectValue("name", "too.short", "Too Short");
    exposeBindingResult(errors);
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    assertNotNull(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE));
View Full Code Here

Examples of org.springframework.validation.BeanPropertyBindingResult.rejectValue()

  public void testAsBodyTagWithExistingMessagesAttribute() throws Exception {
    String existingAttribute = "something";
    getPageContext().setAttribute(ErrorsTag.MESSAGES_ATTRIBUTE, existingAttribute);
    Errors errors = new BeanPropertyBindingResult(new TestBean(), "COMMAND_NAME");
    errors.rejectValue("name", "some.code", "Default Message");
    errors.rejectValue("name", "too.short", "Too Short");
    exposeBindingResult(errors);
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    assertNotNull(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE));
    assertTrue(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE) instanceof List);
View Full Code Here

Examples of org.springframework.validation.BeanPropertyBindingResult.rejectValue()

   */
  public void testAsBodyTagWithErrorsAndExistingMessagesAttributeInNonPageScopeAreNotClobbered() throws Exception {
    String existingAttribute = "something";
    getPageContext().setAttribute(ErrorsTag.MESSAGES_ATTRIBUTE, existingAttribute, PageContext.APPLICATION_SCOPE);
    Errors errors = new BeanPropertyBindingResult(new TestBean(), "COMMAND_NAME");
    errors.rejectValue("name", "some.code", "Default Message");
    errors.rejectValue("name", "too.short", "Too Short");
    exposeBindingResult(errors);
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    assertNotNull(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE));
View Full Code Here

Examples of org.springframework.validation.BeanPropertyBindingResult.rejectValue()

  public void testAsBodyTagWithErrorsAndExistingMessagesAttributeInNonPageScopeAreNotClobbered() throws Exception {
    String existingAttribute = "something";
    getPageContext().setAttribute(ErrorsTag.MESSAGES_ATTRIBUTE, existingAttribute, PageContext.APPLICATION_SCOPE);
    Errors errors = new BeanPropertyBindingResult(new TestBean(), "COMMAND_NAME");
    errors.rejectValue("name", "some.code", "Default Message");
    errors.rejectValue("name", "too.short", "Too Short");
    exposeBindingResult(errors);
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    assertNotNull(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE));
    assertTrue(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE) instanceof List);
View Full Code Here

Examples of org.springframework.validation.BeanPropertyBindingResult.rejectValue()

   */
  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();
    String output = getOutput();
View Full Code Here

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

  public void testPropertyExposing() throws JspException {
    PageContext pc = createPageContext();
    TestBean tb = new TestBean();
    tb.setName("name1");
    Errors errors = new BindException(tb, "tb");
    errors.rejectValue("name", "code1", null, "message & 1");
    errors.rejectValue("name", "code2", null, "message2");
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", errors);

    // test global property (should be null)
    BindTag tag = new BindTag();
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.