Package org.springframework.web.servlet.support

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


  }

  public void testWithCustomObjectAndEditorSelected() throws Exception {
    final PropertyEditor floatEditor = new SimpleFloatEditor();
    floatEditor.setValue(new Float("12.34"));
    BindStatus bindStatus = new BindStatus(getRequestContext(), "testBean.someNumber", false) {
      public PropertyEditor getEditor() {
        return floatEditor;
      }
    };
    getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);
View Full Code Here


    assertBlockTagContains(output, "12.34f");
  }

  public void testWithCustomObjectAndEditorNotSelected() throws Exception {
    final PropertyEditor floatEditor = new SimpleFloatEditor();
    BindStatus bindStatus = new BindStatus(getRequestContext(), "testBean.someNumber", false) {
      public PropertyEditor getEditor() {
        return floatEditor;
      }
    };
    getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);
View Full Code Here

    assertAttributeNotPresent(output, "selected");
    assertBlockTagContains(output, "12.35f");
  }

  public void testAsBodyTag() throws Exception {
    BindStatus bindStatus = new BindStatus(getRequestContext(), "testBean.name", false);
    getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);

    String bodyContent = "some content";

    this.tag.setValue("foo");
View Full Code Here

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

  public void testAsBodyTagSelected() throws Exception {
    BindStatus bindStatus = new BindStatus(getRequestContext(), "testBean.name", false);
    getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);

    String bodyContent = "some content";

    this.tag.setValue("Rob Harrop");
View Full Code Here

    assertOptionTagClosed(output);
    assertBlockTagContains(output, bodyContent);
  }

  public void testAsBodyTagCollapsed() throws Exception {
    BindStatus bindStatus = new BindStatus(getRequestContext(), "testBean.name", false);
    getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);

    String bodyContent = "some content";

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

    assertContainsAttribute(output, "value", bodyContent);
    assertBlockTagContains(output, bodyContent);
  }

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

  public void testMultiBind() throws Exception {
    BeanPropertyBindingResult result = new BeanPropertyBindingResult(new TestBean(), "testBean");
    result.getPropertyAccessor().registerCustomEditor(TestBean.class, "friends", new FriendEditor());
    exposeBindingResult(result);

    BindStatus bindStatus = new BindStatus(getRequestContext(), "testBean.friends", false);

    getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);
    this.tag.setValue(new TestBean("foo"));
    this.tag.doStartTag();
    this.tag.doEndTag();
View Full Code Here

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

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

    this.tag.setItems("${countries}");
    this.tag.setItemValue("isoCode");
    this.tag.setItemLabel("name");
    this.tag.setId("myOption");
View Full Code Here

    BeanPropertyBindingResult errors = new BeanPropertyBindingResult(target, COMMAND_NAME);
    errors.getPropertyAccessor().registerCustomEditor(Float.class, propertyEditor);
    exposeBindingResult(errors);

    getPageContext().setAttribute(
        SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), "testBean.myFloat", false));

    this.tag.setItems("${floats}");
    int result = this.tag.doStartTag();
    assertEquals(Tag.SKIP_BODY, result);
    String output = getOutput();
View Full Code Here

  }

  public void testWithItemsNullReference() throws Exception {
    getPageContext().getRequest().removeAttribute("countries");
    getPageContext().setAttribute(
        SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), "testBean.country", false));

    this.tag.setItems("${countries}");
    this.tag.setItemValue("isoCode");
    this.tag.setItemLabel("name");
    int result = this.tag.doStartTag();
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.