Example usage for javax.servlet.jsp PageContext SESSION_SCOPE

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

Introduction

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

Prototype

int SESSION_SCOPE

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

Click Source Link

Document

Session scope (only valid if this page participates in a session): the named reference remains available from the HttpSession (if any) associated with the Servlet until the HttpSession is invalidated.

Usage

From source file:org.seasar.struts.taglib.S2FormTag.java

protected void initFormBean() throws JspException {
    int scope = PageContext.SESSION_SCOPE;
    if ("request".equalsIgnoreCase(beanScope)) {
        scope = PageContext.REQUEST_SCOPE;
    }/*from  w w  w  . j  av  a2  s  . c o m*/

    Object bean = pageContext.getAttribute(beanName, scope);
    if (bean == null) {
        bean = pageContext.getRequest().getAttribute(beanName);
        if (bean == null) {
            throw new JspException("ActionForm not found.");
        }
    }

    pageContext.setAttribute(Constants.BEAN_KEY, bean, PageContext.REQUEST_SCOPE);
}

From source file:org.squale.squaleweb.tagslib.security.AbstractProfileCheckerTag.java

/**
 * @return the current user's profile for the application {@link #applicationId}
 *///from www .  j av a 2s. co m
private String getUserProfileForApplication() {
    LogonBean user = (LogonBean) pageContext.getAttribute(WConstants.USER_KEY, PageContext.SESSION_SCOPE);

    return (String) user.getProfile(applicationId);
}

From source file:org.squale.welcom.taglib.field.util.LayoutUtils.java

/**
 * Get the label with the key 'key' from the pageContext messageRessources. Handle classic exception
 * //w w w.  j  ava 2  s. c  o m
 * @param pageContext le page context
 * @param pBundle le bundle
 * @param key la cle
 * @param args les arguments
 * @throws JspException exception pouvant etre levee
 * @return le label
 */
public static String getLabel(final PageContext pageContext, final String pBundle, final String key,
        final Object args[]) throws JspException {
    // Acquire the resources object containing our messages
    final MessageResources resources = (MessageResources) pageContext.findAttribute(pBundle);

    if (resources == null) {
        throw new JspException(messages.getMessage("messageTag.resources", pBundle));
    }

    // Calculate the Locale we will be using
    Locale locale = null;

    try {
        locale = (Locale) pageContext.getAttribute(localeKey, PageContext.SESSION_SCOPE);
    } catch (final IllegalStateException e) { // Invalidated session
        locale = null;
    }

    if (locale == null) {
        locale = Locale.getDefault();
    }

    // Retrieve the message string we are looking for
    final String message = resources.getMessage(locale, key, args);

    if (message == null) {
        return key;
    }

    return message;
}

From source file:org.theospi.portfolio.security.control.tag.AuthZMapTag.java

public void setScope(String scope) {
    if (scope.equalsIgnoreCase("page"))
        this.scope = PageContext.PAGE_SCOPE;
    else if (scope.equalsIgnoreCase("request"))
        this.scope = PageContext.REQUEST_SCOPE;
    else if (scope.equalsIgnoreCase("session"))
        this.scope = PageContext.SESSION_SCOPE;
    else if (scope.equalsIgnoreCase("application"))
        this.scope = PageContext.APPLICATION_SCOPE;

    // TODO: Add error handling?  Needs direction from spec.
}