Set JSP PageContext attributes : Page Context « JSP « Java

Set JSP PageContext attributes

<%@ taglib prefix="c" uri="" %>

  synchronized (pageContext) {
    Class thisClass = getClass();
  // session.setAttribute("thisClass", thisClass);
    pageContext.setAttribute("thisClass", thisClass, PageContext.PAGE_SCOPE);
    System.out.println("Stored reference");

    Class theClass = (Class) pageContext.getAttribute("thisClass", PageContext.PAGE_SCOPE);
    System.out.println("The retrieved reference is " + theClass);

    The class that instantiated this JSP is <c:out value="${}" />.


Related examples in the same category

1.Page directive attributes
2.Application Object
3.Set page parameters
4.JSP page scope