Package org.springframework.web.servlet.support

Examples of org.springframework.web.servlet.support.BindStatus


    this.tag.setPageContext(getPageContext());
  }


  public void testCanBeDisabledEvenWhenSelected() throws Exception {
    getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), "testBean.name", false));
    this.tag.setValue("bar");
    this.tag.setLabel("Bar");
    this.tag.setDisabled("true");
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
View Full Code Here


    assertContainsAttribute(output, "disabled", "disabled");
    assertBlockTagContains(output, "Bar");
  }

  public void testRenderNotSelected() throws Exception {
    getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), "testBean.name", false));
    this.tag.setValue("bar");
    this.tag.setLabel("Bar");
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    result = this.tag.doEndTag();
View Full Code Here

    assertContainsAttribute(output, "value", "bar");
    assertBlockTagContains(output, "Bar");
  }

  public void testRenderSelected() throws Exception {
    getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), "testBean.name", false));
    this.tag.setId("myOption");
    this.tag.setValue("foo");
    this.tag.setLabel("Foo");
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
View Full Code Here

    assertContainsAttribute(output, "selected", "selected");
    assertBlockTagContains(output, "Foo");
  }

  public void testWithNoLabel() throws Exception {
    getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), "testBean.name", false));
    this.tag.setValue("bar");
    this.tag.setCssClass("myClass");
    this.tag.setOnclick("CLICK");
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
View Full Code Here

      }
    }.runTest();
  }

  public void testWithEnum() throws Exception {
    getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), "testBean.favouriteColour", false));

    String value = Colour.GREEN.getCode().toString();
    String label = Colour.GREEN.getLabel();

    this.tag.setValue(value);
View Full Code Here

    assertContainsAttribute(output, "selected", "selected");
    assertBlockTagContains(output, label);
  }

  public void testWithEnumNotSelected() throws Exception {
    getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), "testBean.favouriteColour", false));

    String value = Colour.BLUE.getCode().toString();
    String label = Colour.BLUE.getLabel();

    this.tag.setValue(value);
View Full Code Here

    assertAttributeNotPresent(output, "selected");
    assertBlockTagContains(output, label);
  }

  public void testWithPropertyEditor() throws Exception {
    BindStatus bindStatus = new BindStatus(getRequestContext(), "testBean.stringArray", false) {
      public PropertyEditor getEditor() {
        return new StringArrayPropertyEditor();
      }
    };
    getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);
View Full Code Here

  }

  public void testWithPropertyEditorStringComparison() throws Exception {
    final PropertyEditor testBeanEditor = new TestBeanPropertyEditor();
    testBeanEditor.setValue(new TestBean("Sally"));
    BindStatus bindStatus = new BindStatus(getRequestContext(), "testBean.spouse", false) {
      public PropertyEditor getEditor() {
        return testBeanEditor;
      }
    };
    getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);
View Full Code Here

    assertContainsAttribute(output, "selected", "selected");
    assertBlockTagContains(output, "Sally");
  }

  public void testWithCustomObjectSelected() throws Exception {
    getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), "testBean.someNumber", false));
    this.tag.setValue("${myNumber}");
    this.tag.setLabel("GBP ${myNumber}");
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    result = this.tag.doEndTag();
View Full Code Here

    assertContainsAttribute(output, "selected", "selected");
    assertBlockTagContains(output, "GBP 12.34");
  }

  public void testWithCustomObjectNotSelected() throws Exception {
    getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), "testBean.someNumber", false));
    this.tag.setValue("${myOtherNumber}");
    this.tag.setLabel("GBP ${myOtherNumber}");
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    result = this.tag.doEndTag();
View Full Code Here

TOP

Related Classes of org.springframework.web.servlet.support.BindStatus

Copyright © 2018 www.massapicom. 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.