Example usage for org.springframework.web.servlet.tags RequestContextAwareTag REQUEST_CONTEXT_PAGE_ATTRIBUTE

List of usage examples for org.springframework.web.servlet.tags RequestContextAwareTag REQUEST_CONTEXT_PAGE_ATTRIBUTE

Introduction

In this page you can find the example usage for org.springframework.web.servlet.tags RequestContextAwareTag REQUEST_CONTEXT_PAGE_ATTRIBUTE.

Prototype

String REQUEST_CONTEXT_PAGE_ATTRIBUTE

To view the source code for org.springframework.web.servlet.tags RequestContextAwareTag REQUEST_CONTEXT_PAGE_ATTRIBUTE.

Click Source Link

Document

javax.servlet.jsp.PageContext attribute for the page-level RequestContext instance.

Usage

From source file:test.pl.chilldev.facelets.taglib.spring.web.form.ErrorsTagTest.java

@Test
public void applyNoBeanData() throws IOException, FacesException {
    String path = "foo";
    String var = "error";

    Map<String, Object> config = new HashMap<>();
    config.put(ErrorsTag.ATTRIBUTE_PATH, path);
    config.put(ErrorsTag.ATTRIBUTE_VAR, var);

    ErrorsTag tag = new ErrorsTag(MockTagConfig.factory(config, this.nextHandler));

    // set up context
    FaceletContext context = new MockFaceletContext();
    context.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, this.requestContext);

    when(this.requestContext.getErrors(path, false)).thenThrow(new IllegalStateException());

    // run the tag
    tag.apply(context, this.parent);

    verifyZeroInteractions(this.nextHandler);
}

From source file:org.hdiv.web.servlet.tags.form.AbstractHtmlElementTagTests.java

protected final RequestContext getRequestContext() {
    return (RequestContext) getPageContext()
            .getAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE);
}

From source file:org.hdiv.web.servlet.tags.form.AbstractHtmlElementTagTests.java

protected void exposeBindingResult(Errors errors) {
    // wrap errors in a Model
    Map model = new HashMap();
    model.put(BindingResult.MODEL_KEY_PREFIX + COMMAND_NAME, errors);

    // replace the request context with one containing the errors
    MockPageContext pageContext = getPageContext();
    RequestContext context = new RequestContext((HttpServletRequest) pageContext.getRequest(), model);
    pageContext.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, context);
}

From source file:com.javaetmoi.core.mvc.tag.TestHtml5InputTag.java

protected JspAwareRequestContext getRequestContext() {
    return (JspAwareRequestContext) pageContext
            .getAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE);
}

From source file:com.javaetmoi.core.mvc.tag.TestHtml5InputTag.java

protected MockPageContext createAndPopulatePageContext(Map<String, Object> model) {
    MockPageContext pc = createPageContext();
    JspAwareRequestContext requestContext = new JspAwareRequestContext(pc, model);
    pc.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, requestContext);
    return pc;/*from  ww w  .ja  v a2s . c  o  m*/
}