List of usage examples for javax.servlet.jsp PageContext REQUEST_SCOPE
int REQUEST_SCOPE
To view the source code for javax.servlet.jsp PageContext REQUEST_SCOPE.
Click Source Link
From source file:org.apache.tiles.jsp.context.JspUtil.java
/** * Returns true if forced include of the result is needed. * * @param context The page context.//w w w . j a va2 s.c o m * @return If <code>true</code> the include operation must be forced. * @since 2.0.6 */ public static boolean isForceInclude(PageContext context) { Boolean retValue = (Boolean) context.getAttribute(ServletUtil.FORCE_INCLUDE_ATTRIBUTE_NAME, PageContext.REQUEST_SCOPE); return retValue != null && retValue.booleanValue(); }
From source file:org.apache.tiles.jsp.context.JspUtil.java
/** * Sets the option that enables the forced include of the response. * * @param context The page context./*from www .j a va 2 s. co m*/ * @param forceInclude If <code>true</code> the include operation must be * forced. * @since 2.0.6 */ public static void setForceInclude(PageContext context, boolean forceInclude) { Boolean retValue = Boolean.valueOf(forceInclude); context.setAttribute(ServletUtil.FORCE_INCLUDE_ATTRIBUTE_NAME, retValue, PageContext.REQUEST_SCOPE); }
From source file:org.apache.tiles.jsp.context.JspUtil.java
/** * Sets the current container to use in web pages. * * @param context The page context to use. * @param key The key under which the container is stored. * @since 2.1.0//w w w . ja v a2 s . c o m */ public static void setCurrentContainer(PageContext context, String key) { TilesContainer container = getContainer(context, key); if (container != null) { context.setAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME, container, PageContext.REQUEST_SCOPE); } else { throw new NoSuchContainerException("The container with the key '" + key + "' cannot be found"); } }
From source file:org.apache.tiles.jsp.context.JspUtil.java
/** * Sets the current container to use in web pages. * * @param context The page context to use. * @param container The container to use as the current container. * @since 2.1.0/*from ww w . j a v a2s.co m*/ */ public static void setCurrentContainer(PageContext context, TilesContainer container) { if (container != null) { context.setAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME, container, PageContext.REQUEST_SCOPE); } else { throw new NoSuchContainerException("The container cannot be null"); } }
From source file:org.apache.tiles.jsp.context.JspUtil.java
/** * Returns the current container that has been set, or the default one. * * @param context The page context to use. * @return The current Tiles container to use in web pages. * @since 2.1.0// w w w. j a v a2 s.c o m */ public static TilesContainer getCurrentContainer(PageContext context) { TilesContainer container = (TilesContainer) context .getAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME, PageContext.REQUEST_SCOPE); if (container == null) { container = getContainer(context); context.setAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME, container, PageContext.REQUEST_SCOPE); } return container; }
From source file:org.apache.webapp.admin.AttributeTag.java
/** * Render the JMX MBean attribute identified by this tag * * @exception JspException if a processing exception occurs *//*from w w w . ja va2 s .c om*/ public int doEndTag() throws JspException { // Retrieve the object name identified by our attributes Object bean = null; if (scope == null) { bean = pageContext.findAttribute(name); } else if ("page".equalsIgnoreCase(scope)) { bean = pageContext.getAttribute(name, PageContext.PAGE_SCOPE); } else if ("request".equalsIgnoreCase(scope)) { bean = pageContext.getAttribute(name, PageContext.REQUEST_SCOPE); } else if ("session".equalsIgnoreCase(scope)) { bean = pageContext.getAttribute(name, PageContext.SESSION_SCOPE); } else if ("application".equalsIgnoreCase(scope)) { bean = pageContext.getAttribute(name, PageContext.APPLICATION_SCOPE); } else { throw new JspException("Invalid scope value '" + scope + "'"); } if (bean == null) { throw new JspException("No bean '" + name + "' found"); } if (property != null) { try { bean = PropertyUtils.getProperty(bean, property); } catch (Throwable t) { throw new JspException("Exception retrieving property '" + property + "': " + t); } if (bean == null) { throw new JspException("No property '" + property + "' found"); } } // Convert to an object name as necessary ObjectName oname = null; try { if (bean instanceof ObjectName) { oname = (ObjectName) bean; } else if (bean instanceof String) { oname = new ObjectName((String) bean); } else { oname = new ObjectName(bean.toString()); } } catch (Throwable t) { throw new JspException("Exception creating object name for '" + bean + "': " + t); } // Acquire a reference to our MBeanServer MBeanServer mserver = (MBeanServer) pageContext.getAttribute("org.apache.catalina.MBeanServer", PageContext.APPLICATION_SCOPE); if (mserver == null) throw new JspException("MBeanServer is not available"); // Retrieve the specified attribute from the specified MBean Object value = null; try { value = mserver.getAttribute(oname, attribute); } catch (Throwable t) { throw new JspException("Exception retrieving attribute '" + attribute + "'"); } // Render this value to our current output writer if (value != null) { JspWriter out = pageContext.getOut(); try { out.print(value); } catch (IOException e) { throw new JspException("IOException: " + e); } } // Evaluate the remainder of this page return (EVAL_PAGE); }
From source file:org.araneaframework.jsp.tag.basic.UiServerSideKeyboardHandlerTag.java
public static final String createHandlerToCallEvent(PageContext pageContext, String widgetId, String eventId, String eventParam, String precondition, List updateRegionNames) throws JspException { if (widgetId == null) { widgetId = UiWidgetUtil.getContextWidgetFullId(pageContext); }/*from w w w .j a v a 2s .c o m*/ if (eventId == null) eventId = ""; if (eventParam == null) eventParam = ""; if (StringUtils.isBlank(precondition)) precondition = "return true;"; String systemFormId = (String) UiUtil.readAttribute(pageContext, UiSystemFormTag.SYSTEM_FORM_ID_KEY, PageContext.REQUEST_SCOPE); return "function(event, elementId) { " + "uiStandardSubmitEvent(" + "document.forms['" + systemFormId + "'], '" + widgetId + "', '" + eventId + "', '" + eventParam + "', function() { " + UiStdWidgetCallUtil.getContainer(pageContext) .buildWidgetCall(systemFormId, widgetId, eventId, eventParam, updateRegionNames) + "}, function() { " + precondition + "}); }"; }
From source file:org.araneaframework.jsp.tag.uilib.form.UiFormKeyboardHandlerTag.java
protected final int before(Writer out) throws Exception { super.before(out); if (StringUtils.isBlank(handler)) { // One of elemenId/event must be specified if ((elementId == null && fullElementId == null) || event == null) throw new JspException( "You must specify handler or elementId/event for UiFormKeyboardHandlerTag (elementId=" + elementId + ", fullElementId=" + fullElementId + ", event=" + event + ",subscope=" + subscope); // Only one of elementId/fullElementId must be specified if (!(elementId == null ^ fullElementId == null)) throw new JspException("Either elementId or fullElementId must be specified, not both."); // If elementId was given, translate to fullElementId if (fullElementId == null) fullElementId = elementIdToFullElementId(pageContext, elementId); handler = createHandlerToInvokeJavascriptEvent(fullElementId, event); } else {//from w w w . j av a2 s . c om // None of the elementId/event attributes may be specified if (fullElementId != null || elementId != null || event != null) throw new JspException( "You should specify either handler or event for UiFormKeyboardHandlerTag (handler=" + handler + ")"); } // Scope here means the analogue of "scope" attribute in UiKeyboardHandlerTag // It must be prefixed by componentId when the surrounding systemForm's "scope" is "screen". String scope = (String) pageContext.getAttribute(UiFormTag.FORM_SCOPED_FULL_ID_KEY_REQUEST, PageContext.REQUEST_SCOPE); if (!StringUtils.isBlank(subscope)) { if (StringUtils.isBlank(scope)) scope = subscope; else scope = scope + "." + subscope; } // Write out. UiKeyboardHandlerTag.writeRegisterKeypressHandlerScript(out, scope, keyCode, handler); return SKIP_BODY; }
From source file:org.araneaframework.jsp.tag.uilib.form.UiFormKeyboardHandlerTag.java
/** * Given elementId relative wrt the form inside which the tag is located, appends the relevant prefix to it to obtain fullElementId. * @see #setElementId//from w ww . j ava2s . com * @param elementId may not be null! */ public static final String elementIdToFullElementId(PageContext pageContext, String elementId) { // Determine the full id. String fullElementId = elementId; String scope = (String) pageContext.getAttribute(UiFormTag.FORM_SCOPED_FULL_ID_KEY_REQUEST, PageContext.REQUEST_SCOPE); if (!StringUtils.isBlank(scope)) fullElementId = scope + "." + elementId; return fullElementId; }
From source file:org.araneaframework.jsp.util.UiStdWidgetCallUtil.java
public static UiWidgetContainer getContainer(PageContext pageContext) throws JspException { return (UiWidgetContainer) UiUtil.readAttribute(pageContext, UiWidgetContainer.REQUEST_CONTEXT_KEY, PageContext.REQUEST_SCOPE); }