Package org.springframework.validation

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


  public void testBindTagWithIndexedProperties() throws JspException {
    PageContext pc = createPageContext();
    IndexedTestBean tb = new IndexedTestBean();
    Errors errors = new ServletRequestDataBinder(tb, "tb").getBindingResult();
    errors.rejectValue("array[0]", "code1", "message1");
    errors.rejectValue("array[0]", "code2", "message2");
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", errors);

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


  public void testBindTagWithMappedProperties() throws JspException {
    PageContext pc = createPageContext();
    IndexedTestBean tb = new IndexedTestBean();
    Errors errors = new ServletRequestDataBinder(tb, "tb").getBindingResult();
    errors.rejectValue("map[key1]", "code1", "message1");
    errors.rejectValue("map[key1]", "code2", "message2");
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", errors);

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

  public void testBindTagWithMappedProperties() throws JspException {
    PageContext pc = createPageContext();
    IndexedTestBean tb = new IndexedTestBean();
    Errors errors = new ServletRequestDataBinder(tb, "tb").getBindingResult();
    errors.rejectValue("map[key1]", "code1", "message1");
    errors.rejectValue("map[key1]", "code2", "message2");
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", errors);

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

      public String getAsText() {
        return "something";
      }
    });
    Errors errors = binder.getBindingResult();
    errors.rejectValue("array[0]", "code1", "message1");
    errors.rejectValue("array[0]", "code2", "message2");
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", errors);

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

        return "something";
      }
    });
    Errors errors = binder.getBindingResult();
    errors.rejectValue("array[0]", "code1", "message1");
    errors.rejectValue("array[0]", "code2", "message2");
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", errors);

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

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

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

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

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

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

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

  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

    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

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.