public void setAttribute()

in velocity-tools-view-jsp/src/main/java/org/apache/velocity/tools/view/jsp/jspimpl/VelocityPageContext.java [206:235]


    public void setAttribute(String name, Object value, int scope) {
    	if (name == null) {
    		throw new NullPointerException("The attribute name is null");
    	}
        switch (scope)
        {
        case PAGE_SCOPE:
        	velocityContext.put(name, value);
	        break;
        case REQUEST_SCOPE:
        	request.setAttribute(name, value);
        	break;
        case SESSION_SCOPE:
        	if (value == null) {
        		HttpSession session = request.getSession(false);
        		if (session != null) {
        			session.removeAttribute(name);
        		}
        	} else {
        		HttpSession session = request.getSession();
        		session.setAttribute(name, value);
        	}
        	break;
        case APPLICATION_SCOPE:
        	viewContext.getServletContext().setAttribute(name, value);
        	break;
        default:
        	throw new IllegalArgumentException("Invalid scope constant value: " + scope);
        }
    }