use of org.springframework.web.servlet.support.BindStatus in project spring-framework by spring-projects.
the class BindTagTests method bindTagWithToStringAndHtmlEscaping.
@Test
public void bindTagWithToStringAndHtmlEscaping() throws JspException {
PageContext pc = createPageContext();
BindTag tag = new BindTag();
tag.setPageContext(pc);
tag.setPath("tb.doctor");
tag.setHtmlEscape(true);
TestBean tb = new TestBean("somebody", 99);
NestedTestBean ntb = new NestedTestBean("juergen&eva");
tb.setDoctor(ntb);
pc.getRequest().setAttribute("tb", tb);
tag.doStartTag();
BindStatus status = (BindStatus) pc.getAttribute(BindTag.STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
assertEquals("doctor", status.getExpression());
assertTrue(status.getValue() instanceof NestedTestBean);
assertTrue(status.getDisplayValue().indexOf("juergen&eva") != -1);
}
use of org.springframework.web.servlet.support.BindStatus in project spring-framework by spring-projects.
the class BindTagTests method bindTagWithFieldButWithoutErrorsInstance.
@Test
public void bindTagWithFieldButWithoutErrorsInstance() throws JspException {
PageContext pc = createPageContext();
BindTag tag = new BindTag();
tag.setPageContext(pc);
tag.setPath("tb.name");
pc.getRequest().setAttribute("tb", new TestBean("juergen&eva", 99));
tag.doStartTag();
BindStatus status = (BindStatus) pc.getAttribute(BindTag.STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
assertEquals("name", status.getExpression());
assertEquals("juergen&eva", status.getValue());
}
Aggregations