Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

10. Custom Tag Development: When even JS... > Using the PageContext API for tag ha...

Using the PageContext API for tag handlers

This page is just a review from what you saw in the Script-free JSPs chapter, but it comes up again here because it’s crucial for a tag handler. A tag handler class, remember, is not a servlet or a JSP, so it doesn’t have automatic access to a bunch of implicit objects. But it does get a reference to a PageContext, and with it, it can get to all kinds of things it might need.

Remember that while Simple tags get a reference to a JspContext and Classic tags get a reference to a PageContext, the Simple tag’s JspContext is usually a PageContext instance. So if your Simple tag handler needs access to PageContext-specific methods or fields, you’ll have to cast it from a JspContext to the PageContext it really is on the heap.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial