public Object getAttribute(String name, int scope) { if(scope == PageContext.PAGE_SCOPE) { return attributes.get(name); } else if(scope == PageContext.REQUEST_SCOPE) { if(null == request) return null; return request.getAttribute(name); } else if(scope == PageContext.SESSION_SCOPE) { if(null == getSession()) return null; return getSession().getAttribute(name); } else if(scope == PageContext.APPLICATION_SCOPE) { if(null == getServletContext()) return null; return getServletContext().getAttribute(name); } else { throw new IllegalArgumentException("Invalid scope " + scope); } }
public Object getAttribute(String name, int scope) { if(scope == PageContext.PAGE_SCOPE) { return attributes.get(name); } else if(scope == PageContext.REQUEST_SCOPE) { if(null == request) return null; return request.getAttribute(name); } else if(scope == PageContext.SESSION_SCOPE) { if(null == getSession()) return null; return getSession().getAttribute(name); } else if(scope == PageContext.APPLICATION_SCOPE) { if(null == getServletContext()) return null; return getServletContext().getAttribute(name); } else { throw new IllegalArgumentException("Invalid scope " + scope); } }
public Object getAttribute(String name, int scope) { if(scope == PageContext.PAGE_SCOPE) { return attributes.get(name); } else if(scope == PageContext.REQUEST_SCOPE) { if(null == request) return null; return request.getAttribute(name); } else if(scope == PageContext.SESSION_SCOPE) { if(null == getSession()) return null; return getSession().getAttribute(name); } else if(scope == PageContext.APPLICATION_SCOPE) { if(null == getServletContext()) return null; return getServletContext().getAttribute(name); } else { throw new IllegalArgumentException("Invalid scope " + scope); } }
if(getServletContext() != null) getServletContext().removeAttribute(name);
if(getServletContext() != null) getServletContext().removeAttribute(name);
if(getServletContext() != null) getServletContext().setAttribute(name, value);
if(getServletContext() != null) getServletContext().removeAttribute(name);
if(getServletContext() != null) getServletContext().setAttribute(name, value);
if(getServletContext() != null) getServletContext().setAttribute(name, value);
public Enumeration getAttributeNamesInScope(int scope) { if(scope == PageContext.PAGE_SCOPE) { return new WrappedEnumeration(attributes.keySet().iterator()); } else if(scope == PageContext.REQUEST_SCOPE) { if(request == null) return new NullEnumeration(); return request.getAttributeNames(); } else if(scope == PageContext.SESSION_SCOPE) { if(getSession() == null) return new NullEnumeration(); return getSession().getAttributeNames(); } else if(scope == PageContext.APPLICATION_SCOPE) { if(getServletContext() == null) return new NullEnumeration(); return getServletContext().getAttributeNames(); } else { throw new IllegalArgumentException("Invalid scope " + scope); } }
public Enumeration getAttributeNamesInScope(int scope) { if(scope == PageContext.PAGE_SCOPE) { return new WrappedEnumeration(attributes.keySet().iterator()); } else if(scope == PageContext.REQUEST_SCOPE) { if(request == null) return new NullEnumeration(); return request.getAttributeNames(); } else if(scope == PageContext.SESSION_SCOPE) { if(getSession() == null) return new NullEnumeration(); return getSession().getAttributeNames(); } else if(scope == PageContext.APPLICATION_SCOPE) { if(getServletContext() == null) return new NullEnumeration(); return getServletContext().getAttributeNames(); } else { throw new IllegalArgumentException("Invalid scope " + scope); } }
public Enumeration getAttributeNamesInScope(int scope) { if(scope == PageContext.PAGE_SCOPE) { return new WrappedEnumeration(attributes.keySet().iterator()); } else if(scope == PageContext.REQUEST_SCOPE) { if(request == null) return new NullEnumeration(); return request.getAttributeNames(); } else if(scope == PageContext.SESSION_SCOPE) { if(getSession() == null) return new NullEnumeration(); return getSession().getAttributeNames(); } else if(scope == PageContext.APPLICATION_SCOPE) { if(getServletContext() == null) return new NullEnumeration(); return getServletContext().getAttributeNames(); } else { throw new IllegalArgumentException("Invalid scope " + scope); } }