The example on the opposite page shows the JSP setting an application-scoped attribute using a method declaration that overrides jspInit(). But most of the time you’ll be using one of the four implicit objects to get and set attributes corresponding to the four attribute scopes available in a JSP.
Yes, four. Remember, in addition to the standard servlet request, session, and application (context) scopes, a JSP adds a fourth scope—page scope—that you get from a pageContext object.
You usually won’t need (or care about) page scope unless you’re developing custom tags, so we won’t say any more about it until the custom tags chapter.
In a servlet
In a JSP (using implicit objects)
Does not apply!
But this isn’t the whole story! In a JSP, there’s another way to get and set attributes at any scope, using only the pageContext implicit object. Turn the page and find out how...
There’s no such thing as “context” scope... even though attributes in application scope are bound to the ServletContext object.
The naming convention might trick you into thinking that attributes stored in the ServletContext are... context scope. But there’s no such thing. Remember, when you ...