Example usage for org.springframework.web.servlet.support RequestContext getBindStatus

List of usage examples for org.springframework.web.servlet.support RequestContext getBindStatus

Introduction

In this page you can find the example usage for org.springframework.web.servlet.support RequestContext getBindStatus.

Prototype

public BindStatus getBindStatus(String path) throws IllegalStateException 

Source Link

Document

Create a BindStatus for the given bind object, using the "defaultHtmlEscape" setting.

Usage

From source file:org.hdiv.web.servlet.view.freemarker.FreeMarkerMacroTests.java

public void testExposeSpringMacroHelpers() throws Exception {
    FreeMarkerView fv = new FreeMarkerView() {
        @Override/* w ww. j  a  v a2s  . c om*/
        protected void processTemplate(Template template, SimpleHash fmModel, HttpServletResponse response)
                throws TemplateException {
            Map model = fmModel.toMap();
            assertTrue(
                    model.get(FreeMarkerView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE) instanceof RequestContext);
            RequestContext rc = (RequestContext) model
                    .get(FreeMarkerView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE);
            BindStatus status = rc.getBindStatus("tb.name");
            assertEquals("name", status.getExpression());
            assertEquals("juergen", status.getValue());
        }
    };
    fv.setUrl(TEMPLATE_FILE);
    fv.setApplicationContext(wac);
    fv.setExposeSpringMacroHelpers(true);

    Map model = new HashMap();
    model.put("tb", new TestBean("juergen", 99));
    fv.render(model, request, response);
}