Aborting the Page Processing
In Chapter 9, I
described how using the <jsp:forward> action
or the JSTL <c:redirect> action shifts
processing from the current page to the page specified by the page
attribute, effectively aborting processing of the current page.
Custom actions implemented as Java classes can cause the same thing
to happen.
There’s no directive or similar mechanism that a tag
file can use to explicitly abort processing, but using
<jsp:forward>,
<c:redirect>, or a custom action that aborts
page processing in a tag file has the same effect; both the tag file
processing and the processing of the page that invokes the tag file
stop after it aborts the processing. You can use this feature to, for
instance, develop a smart forwarding action that decides which page
to forward to based on runtime conditions, such as the time of the
day, the current user, or the type of browser accessing the page.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access