String var, String scope, Object value)
throws JspException
{
if (var == null) {
if (scope != null && ! "".equals(scope))
throw new JspException(L.l("var must not be null when scope '{0}' is set.",
scope));
}
else if ("".equals(var)) {
throw new JspException(L.l("var must not be ''"));
}
else if (scope == null || scope.equals("page")) {
if (value != null)
pageContext.setAttribute(var, value);
else
pageContext.removeAttribute(var);
}
else if (scope.equals("request")) {
if (value != null)
pageContext.getRequest().setAttribute(var, value);
else
pageContext.getRequest().removeAttribute(var);
}
else if (scope.equals("session")) {
if (value != null)
pageContext.getSession().setAttribute(var, value);
else
pageContext.getSession().removeAttribute(var);
}
else if (scope.equals("application")) {
if (value != null)
pageContext.getServletContext().setAttribute(var, value);
else
pageContext.getServletContext().removeAttribute(var);
}
else
throw new JspException(L.l("illegal scope value {0}", scope));
}