Examples of rejectValue()


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

  public void testBindTagWithFieldErrorsAndNoDefaultMessage() throws JspException {
    PageContext pc = createPageContext();
    TestBean tb = new TestBean();
    tb.setName("name1");
    Errors errors = new ServletRequestDataBinder(tb, "tb").getBindingResult();
    errors.rejectValue("name", "code1");
    errors.rejectValue("name", "code2");
    errors.rejectValue("age", "code2");
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", errors);

    BindTag tag = new BindTag();
View Full Code Here

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

    PageContext pc = createPageContext();
    TestBean tb = new TestBean();
    tb.setName("name1");
    Errors errors = new ServletRequestDataBinder(tb, "tb").getBindingResult();
    errors.rejectValue("name", "code1");
    errors.rejectValue("name", "code2");
    errors.rejectValue("age", "code2");
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", errors);

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

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

    DefaultMessageContext context = new DefaultMessageContext(messageSource);
    Object object = new Object();
    MessageContextErrors errors = new MessageContextErrors(context, "object", object, null, null);
    MapBindingResult result = new MapBindingResult(new HashMap(), "object");
    result.reject("bar", new Object[] { "boop" }, null);
    result.rejectValue("field", "bar", new Object[] { "boop" }, null);
    errors.addAllErrors(result);

    Message msg = context.getAllMessages()[0];
    assertEquals(null, msg.getSource());
    assertEquals("boop", msg.getText());
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.