Example usage for javax.servlet.jsp PageContext PAGE_SCOPE

List of usage examples for javax.servlet.jsp PageContext PAGE_SCOPE

Introduction

In this page you can find the example usage for javax.servlet.jsp PageContext PAGE_SCOPE.

Prototype

int PAGE_SCOPE

To view the source code for javax.servlet.jsp PageContext PAGE_SCOPE.

Click Source Link

Document

Page scope: (this is the default) the named reference remains available in this PageContext until the return from the current Servlet.service() invocation.

Usage

From source file:com.geemvc.taglib.GeemvcTagSupport.java

protected int scope() {
    if (scope == null)
        return PageContext.PAGE_SCOPE;

    switch (scope.toLowerCase().trim()) {
    case REQUEST_SCOPE:
        return PageContext.REQUEST_SCOPE;
    case SESSION_SCOPE:
        return PageContext.SESSION_SCOPE;
    default://from   www  .ja  v  a  2 s .  c  o m
        return PageContext.PAGE_SCOPE;
    }
}

From source file:com.glaf.core.tag.TagUtils.java

/**
 * Returns the appropriate MessageResources object for the current module
 * and the given bundle.//from  w  w  w. j a va 2s.c  om
 * 
 * @param pageContext
 *            Search the context's scopes for the resources.
 * @param bundle
 *            The bundle name to look for. If this is <code>null</code>, the
 *            default bundle name is used.
 * @param checkPageScope
 *            Whether to check page scope
 * @return MessageResources The bundle's resources stored in some scope.
 * @throws JspException
 *             if the MessageResources object could not be found.
 */
public MessageResources retrieveMessageResources(PageContext pageContext, String bundle, boolean checkPageScope)
        throws JspException {
    MessageResources resources = null;

    if (bundle == null) {
        bundle = conf.get("i18n.messages_key");
    }

    if (bundle == null) {
        bundle = Globals.MESSAGES_KEY;
    }

    if (checkPageScope) {
        resources = (MessageResources) pageContext.getAttribute(bundle, PageContext.PAGE_SCOPE);
    }

    if (resources == null) {
        resources = (MessageResources) pageContext.getAttribute(bundle, PageContext.REQUEST_SCOPE);
    }

    if (resources == null) {
        resources = (MessageResources) pageContext.getAttribute(bundle, PageContext.APPLICATION_SCOPE);
    }

    if (resources == null) {
        resources = (MessageResources) pageContext.getAttribute(Globals.DEFAULT_RESOURCE_NAME,
                PageContext.APPLICATION_SCOPE);
        if (resources == null) {
            resources = PropertyMessageResourcesFactory.createFactory()
                    .createResources(Globals.DEFAULT_RESOURCE_NAME);
            pageContext.setAttribute(Globals.DEFAULT_RESOURCE_NAME, resources, PageContext.APPLICATION_SCOPE);
        }
    }

    if (resources == null) {
        JspException e = new JspException(messages.getMessage("message.bundle", bundle));

        saveException(pageContext, e);
        throw e;
    }

    return resources;
}

From source file:net.sourceforge.subsonic.taglib.UrlTag.java

public int doEndTag() throws JspException {

    // Rewrite and encode the url.
    String result = formatUrl();/*from   w w  w . j  a v  a  2s .com*/

    // Store or print the output
    if (var != null)
        pageContext.setAttribute(var, result, PageContext.PAGE_SCOPE);
    else {
        try {
            pageContext.getOut().print(result);
        } catch (IOException x) {
            throw new JspTagException(x);
        }
    }
    return EVAL_PAGE;
}

From source file:nl.strohalm.cyclos.taglibs.AbstractEscapeTag.java

public void setScope(String scope) {
    scope = StringUtils.trimToNull(scope);
    if ("application".equalsIgnoreCase(scope)) {
        this.scope = PageContext.APPLICATION_SCOPE;
    } else if ("session".equalsIgnoreCase(scope)) {
        this.scope = PageContext.SESSION_SCOPE;
    } else if ("request".equalsIgnoreCase(scope)) {
        this.scope = PageContext.REQUEST_SCOPE;
    } else {/*from   ww  w .  ja v  a 2 s .  c  om*/
        this.scope = PageContext.PAGE_SCOPE;
    }
}

From source file:nl.strohalm.cyclos.taglibs.AbstractEscapeTag.java

private void init() {
    value = null;
    body = null;
    var = null;
    scope = PageContext.PAGE_SCOPE;
}

From source file:nl.strohalm.cyclos.taglibs.CustomizedFilePathTag.java

@Override
public void release() {
    super.release();
    var = null;
    scope = PageContext.PAGE_SCOPE;
}

From source file:nl.strohalm.cyclos.taglibs.SelectCustomFieldsTag.java

@Override
public void release() {
    super.release();
    allFields = null;
    var = null;
    group = null;
    scope = PageContext.PAGE_SCOPE;
}

From source file:org.apache.cactus.extension.jsp.JspTagLifecycle.java

/**
 * Adds a special expectation that verifies that a specific scoped variable
 * is exposed in the body of the tag.//  w  ww  .java 2  s  . c o  m
 * 
 * @param theName The name of the variable
 * @param theExpectedValues An ordered list containing the expected values 
 *        values of the scoped variable, one for each expected iteration
 *        step
 */
public void expectScopedVariableExposed(String theName, Object[] theExpectedValues) {
    expectScopedVariableExposed(theName, theExpectedValues, PageContext.PAGE_SCOPE);
}

From source file:org.apache.cactus.extension.jsp.JspTagLifecycle.java

/**
 * Adds a special expectation that verifies that a specific scoped variable
 * is exposed in the body of the tag./*from  ww w . j a  v  a2s  .  co m*/
 * 
 * @param theName The name of the variable
 * @param theExpectedValues An ordered list containing the expected values 
 *        values of the scoped variable, one for each expected iteration
 *        step
 * @param theScope The scope under which the variable is stored
 */
public void expectScopedVariableExposed(String theName, Object[] theExpectedValues, int theScope) {
    if ((theName == null) || (theExpectedValues == null)) {
        throw new NullPointerException();
    }
    if (theExpectedValues.length == 0) {
        throw new IllegalArgumentException();
    }
    if ((theScope != PageContext.PAGE_SCOPE) && (theScope != PageContext.REQUEST_SCOPE)
            && (theScope != PageContext.SESSION_SCOPE) && (theScope != PageContext.APPLICATION_SCOPE)) {
        throw new IllegalArgumentException();
    }
    addInterceptor(new ExpectScopedVariableExposedInterceptor(theName, theExpectedValues, theScope));
}

From source file:org.apache.sling.scripting.jsp.taglib.IncludeTagHandler.java

public void setPageContext(PageContext pageContext) {
    super.setPageContext(pageContext);

    // init local fields, since tag might be reused
    flush = false;/*ww w. j a  va 2s  .  c o  m*/
    this.var = null;
    this.scope = PageContext.PAGE_SCOPE;
}