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:com.benfante.taglib.frontend.tags.CheckboxTag.java
protected String autogenerateErrorId() throws JspException { String path = getPropertyPath(); if ("".equals(path) || "*".equals(path)) { path = (String) this.pageContext.getAttribute(FormTag.MODEL_ATTRIBUTE_VARIABLE_NAME, PageContext.REQUEST_SCOPE); }/*from w w w.java2 s . c o m*/ return StringUtils.deleteAny(path, "[]") + ".errors"; }
From source file:net.ontopia.topicmaps.webed.taglibs.form.FormTag.java
@Override public int doStartTag() throws JspException { NavigatorPageIF contextTag = FrameworkUtils.getContextTag(pageContext); if (contextTag == null) throw new JspTagException("<webed:form> must be nested" + " within a <tolog:context> tag, but no" + " <tolog:context> was found."); if (TagSupport.findAncestorWithClass(this, FormTag.class) != null) throw new JspTagException("<webed:form> cannot be nested"); HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); boolean readonly = InteractionELSupport.getBooleanValue(this.readonly, false, pageContext); request.setAttribute(Constants.OKS_FORM_READONLY, readonly); // put the name of the action group to page scope // to allow child tags to access this information TagUtils.setActionGroup(pageContext, actiongroup); TagUtils.setCurrentFormTag(request, this); requestId = TagUtils.createRequestId(); // -- try to lock variable UserIF user = FrameworkUtils.getUser(pageContext); if (lockVarname != null) { ActionRegistryIF registry = TagUtils.getActionRegistry(pageContext); if (registry == null) throw new JspException( "No action registry! Check actions.xml for " + "errors; see log for details."); Collection lockColl = InteractionELSupport.extendedGetValue(lockVarname, pageContext); NamedLockManager lockMan = TagUtils.getNamedLockManager(pageContext.getServletContext()); LockResult lockResult = lockMan.attemptToLock(user, lockColl, lockVarname, pageContext.getSession()); lockVarname = lockResult.getName(); Collection unlockable = lockResult.getUnlockable(); request.setAttribute(Constants.LOCK_RESULT, lockResult); if (!unlockable.isEmpty()) { logger.warn("Unable to lock contents of variable '" + lockVarname + "'." + unlockable); // forward to error page if variable is locked ActionGroupIF ag = registry.getActionGroup(actiongroup); ActionForwardPageIF forwardPage = ag.getLockedForwardPage(); if (forwardPage != null && forwardPage.getURL() != null) { String fwd_url = forwardPage.getURL(); logger.info("Forward to lock error page: " + fwd_url); try { ((HttpServletResponse) pageContext.getResponse()).sendRedirect(fwd_url); } catch (IOException ioe) { logger.error("Problem occurred while forwarding: " + ioe.getMessage()); throw new JspException("I/O-Problem while forwarding to '" + fwd_url + "': " + ioe); }/*from w w w. j a va2s .co m*/ return SKIP_PAGE; } else { logger.warn("No forward page found for lock situation. Setting form to be read-only"); request.setAttribute(Constants.OKS_FORM_READONLY, Boolean.TRUE); } } else { logger.info("Locked contents of variable '" + lockVarname + "'."); } } // register a new action data set pageContext.setAttribute(FormTag.REQUEST_ID_ATTRIBUTE_NAME, requestId, PageContext.REQUEST_SCOPE); TagUtils.createActionDataSet(pageContext); return EVAL_BODY_BUFFERED; }
From source file:javax.faces.webapp.UIComponentTag.java
/** See documentation for pushTag. */ private void popTag() { List list = (List) pageContext.getAttribute(COMPONENT_STACK_ATTR, PageContext.REQUEST_SCOPE); if (list != null) { int size = list.size(); list.remove(size - 1);//from w w w . j av a2 s .c o m if (size <= 1) { pageContext.removeAttribute(COMPONENT_STACK_ATTR, PageContext.REQUEST_SCOPE); } } }
From source file:de.micromata.genome.gwiki.page.gspt.ServletStandalonePageContext.java
@Override public void removeAttribute(String key, int scope) { switch (scope) { case PageContext.PAGE_SCOPE: pageAttributes.remove(key);/*w ww . j a v a2 s .c o m*/ break; case PageContext.REQUEST_SCOPE: request.removeAttribute(key); break; case PageContext.SESSION_SCOPE: if (session != null) { session.removeAttribute(key); } break; case PageContext.APPLICATION_SCOPE: servletCtx.removeAttribute(key); break; default: break; } }
From source file:javax.faces.webapp.UIComponentTag.java
/** * Push this tag onto the stack of JSP tags seen. * <p>//from www. java2 s .co m * The pageContext's request scope map is used to hold a stack of * JSP tag objects seen so far, so that a new tag can find the * parent tag that encloses it. Access to the parent tag is used * to find the parent UIComponent for the component associated * with this tag plus some other uses. */ private void pushTag() { List list = (List) pageContext.getAttribute(COMPONENT_STACK_ATTR, PageContext.REQUEST_SCOPE); if (list == null) { list = new ArrayList(); pageContext.setAttribute(COMPONENT_STACK_ATTR, list, PageContext.REQUEST_SCOPE); } list.add(this); }
From source file:org.sakaiproject.iclicker.tool.ToolController.java
/************************************************************************** * View handling methods// w w w .j a v a 2 s .co m ************************************************************************** */ public void processRegistration(PageContext pageContext, HttpServletRequest request) { // Handle the POST if there is one pageContext.setAttribute("newRegistration", false); pageContext.setAttribute("clickerIdText", ""); if ("POST".equalsIgnoreCase(request.getMethod())) { if ((request.getParameter("register") != null)) { // we are registering a clicker if ((request.getParameter("clickerId") == null)) { ToolController.addMessage(pageContext, ToolController.KEY_ERROR, "reg.activate.clickerId.empty", (Object[]) null); } else { String clickerId = request.getParameter("clickerId"); pageContext.setAttribute("clickerIdText", clickerId); // save a new clicker registration try { this.getLogic().createRegistration(clickerId); ToolController.addMessage(pageContext, ToolController.KEY_INFO, "reg.registered.success", clickerId); ToolController.addMessage(pageContext, ToolController.KEY_BELOW, "reg.registered.below.success", (Object[]) null); pageContext.setAttribute("newRegistration", true); } catch (ClickerRegisteredException e) { ToolController.addMessage(pageContext, ToolController.KEY_ERROR, "reg.registered.clickerId.duplicate", clickerId); ToolController.addMessage(pageContext, ToolController.KEY_BELOW, "reg.registered.below.duplicate", clickerId); } catch (ClickerIdInvalidException e) { if (Failure.EMPTY.equals(e.failure)) { ToolController.addMessage(pageContext, ToolController.KEY_ERROR, "reg.registered.clickerId.empty", (Object[]) null); } else if (Failure.LENGTH.equals(e.failure)) { ToolController.addMessage(pageContext, ToolController.KEY_ERROR, "reg.registered.clickerId.wrong.length", (Object[]) null); } else if (Failure.GO_NO_USER.equals(e.failure)) { ToolController.addMessage(pageContext, ToolController.KEY_ERROR, "reg.registered.clickerId.failure", clickerId); } else if (Failure.GO_LASTNAME.equals(e.failure)) { ToolController.addMessage(pageContext, ToolController.KEY_ERROR, "reg.registered.clickerId.go.wrong.lastname", (Object[]) null); } else if (Failure.GO_NO_MATCH.equals(e.failure)) { ToolController.addMessage(pageContext, ToolController.KEY_ERROR, "reg.registered.clickerId.go.invalid", clickerId); } else { ToolController.addMessage(pageContext, ToolController.KEY_ERROR, "reg.registered.clickerId.invalid", clickerId); } } } } else if ((request.getParameter("activate") != null)) { // First arrived at this page boolean activate = Boolean.parseBoolean(request.getParameter("activate")); if ((request.getParameter("registrationId") == null)) { ToolController.addMessage(pageContext, ToolController.KEY_ERROR, "reg.activate.registrationId.empty", (Object[]) null); } else { try { Long registrationId = Long.parseLong(request.getParameter("registrationId")); // save a new clicker registration ClickerRegistration cr = this.getLogic().setRegistrationActive(registrationId, activate); if (cr != null) { ToolController.addMessage(pageContext, ToolController.KEY_INFO, "reg.activate.success." + cr.isActivated(), cr.getClickerId()); } } catch (NumberFormatException e) { ToolController.addMessage(pageContext, ToolController.KEY_ERROR, "reg.activate.registrationId.nonnumeric", request.getParameter("registrationId")); } } } else if ((request.getParameter("remove") != null)) { if ((request.getParameter("registrationId") == null)) { ToolController.addMessage(pageContext, ToolController.KEY_ERROR, "reg.activate.registrationId.empty", (Object[]) null); } else { try { Long registrationId = Long.parseLong(request.getParameter("registrationId")); // remove a new clicker registration by deactivating it ClickerRegistration cr = this.getLogic().setRegistrationActive(registrationId, false); if (cr != null) { ToolController.addMessage(pageContext, ToolController.KEY_INFO, "reg.remove.success", cr.getClickerId()); } } catch (NumberFormatException e) { ToolController.addMessage(pageContext, ToolController.KEY_ERROR, "reg.activate.registrationId.nonnumeric", request.getParameter("registrationId")); } } } else { // invalid POST System.err.println("WARN: Invalid POST: does not contain register or activate, nothing to do"); } } pageContext.setAttribute("regs", this.getAllVisibleItems(null)); pageContext.setAttribute("isInstructor", this.isInstructor(), PageContext.REQUEST_SCOPE); // SSO handling pageContext.setAttribute("ssoEnabled", logic.isSingleSignOnEnabled()); // added to allow special messages below the forms pageContext.setAttribute("belowMessages", ToolController.getMessages(pageContext, ToolController.KEY_BELOW), PageContext.REQUEST_SCOPE); }
From source file:com.icesoft.faces.webapp.parser.ImplementationUtil.java
/** * Returns the component tag stack, including checking in the current * request as is the strategy of JSF 1.1_02 * @param pageContext/* w w w .j av a 2 s . c o m*/ * @return list being the component tag stack */ public static List getComponentStack(PageContext pageContext) { List list = (List) pageContext.getAttribute(getComponentStackKey(), PageContext.REQUEST_SCOPE); if (null == list) { list = (List) FacesContext.getCurrentInstance().getExternalContext().getRequestMap() .get(getComponentStackKey()); } return list; }
From source file:org.gvnix.datatables.tags.RooColumnTag.java
/** * TBC// www . ja va 2 s . c om * * @param tag * @param pageContext * @return */ public Tag getParent() { // If not found so we try to find in page context. Note RooTableTag // must add the reference to itself in doStartTag() method Tag parent = (Tag) pageContext.getAttribute(RooTableTag.TABLE_TAG_VARIABLE, PageContext.REQUEST_SCOPE); if (parent != null) { return parent; } return super.getParent(); }
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 w ww.j a v a2 s .co m return PageContext.PAGE_SCOPE; } }
From source file:de.hybris.platform.acceleratorcms.tags2.CMSContentSlotTag.java
protected void exposeVariables() { pageContext.setAttribute(varAttribute, currentComponent, PageContext.REQUEST_SCOPE); pageContext.setAttribute("contentSlot", currentContentSlot, PageContext.REQUEST_SCOPE); pageContext.setAttribute("elementPos", Integer.valueOf(currentIndex), PageContext.REQUEST_SCOPE); pageContext.setAttribute("isFirstElement", Boolean.valueOf(currentIndex == 0), PageContext.REQUEST_SCOPE); final int size = currentComponents.size(); pageContext.setAttribute("isLastElement", Boolean.valueOf(currentIndex == (size - 1)), PageContext.REQUEST_SCOPE);/*w w w .j a v a 2 s . c om*/ pageContext.setAttribute("numberOfElements", Integer.valueOf(size), PageContext.REQUEST_SCOPE); }