O'Reilly logo

Head First Servlets and JSP, 2nd Edition by Bert Bates, Bryan Basham, Kathy Sierra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

SkipPageException: stops processing the page...

Imagine you’re in a page that invokes the tag, and the tag depends on specific request attributes (that it gets from the JspContext available to the tag handler).

Now imagine the tag can’t find the attributes it needs, and that the tag knows the rest of the page will never work if the tag can’t succeed. What do you do? You could have the tag throw a JspException, and that would kill the page... but what if it’s only the rest of the page that won’t work? In other words, what if you still want the first part of the page—the part of the page that’s evaluated before the tag invocation—to still appear as the response, but you don’t want the response to include anything still left to be processed after the tag throws an exception?

No problem. That’s exactly why SkipPageException exists.

The tag handler doTag() method

image with no caption

The JSP that invokes the tag

image with no caption

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required