Search in sources :

Example 1 with BindTag

use of org.springframework.web.servlet.tags.BindTag in project spring-framework by spring-projects.

the class InputTagTests method simpleBindTagWithinForm.

@Test
public void simpleBindTagWithinForm() throws Exception {
    BindTag bindTag = new BindTag();
    bindTag.setPath("name");
    bindTag.setPageContext(getPageContext());
    bindTag.doStartTag();
    BindStatus bindStatus = (BindStatus) getPageContext().findAttribute(BindTag.STATUS_VARIABLE_NAME);
    assertEquals("Rob", bindStatus.getValue());
}
Also used : BindTag(org.springframework.web.servlet.tags.BindTag) BindStatus(org.springframework.web.servlet.support.BindStatus) Test(org.junit.Test)

Example 2 with BindTag

use of org.springframework.web.servlet.tags.BindTag in project spring-framework by spring-projects.

the class InputTagTests method withNestedBindTagWithinForm.

@Test
public void withNestedBindTagWithinForm() throws Exception {
    NestedPathTag nestedPathTag = new NestedPathTag();
    nestedPathTag.setPath("spouse.");
    nestedPathTag.setPageContext(getPageContext());
    nestedPathTag.doStartTag();
    BindTag bindTag = new BindTag();
    bindTag.setPath("name");
    bindTag.setPageContext(getPageContext());
    bindTag.doStartTag();
    BindStatus bindStatus = (BindStatus) getPageContext().findAttribute(BindTag.STATUS_VARIABLE_NAME);
    assertEquals("Sally", bindStatus.getValue());
}
Also used : NestedPathTag(org.springframework.web.servlet.tags.NestedPathTag) BindTag(org.springframework.web.servlet.tags.BindTag) BindStatus(org.springframework.web.servlet.support.BindStatus) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 BindStatus (org.springframework.web.servlet.support.BindStatus)2 BindTag (org.springframework.web.servlet.tags.BindTag)2 NestedPathTag (org.springframework.web.servlet.tags.NestedPathTag)1