Basically, we want to create a taglib that can possibly forward request execution to another page, similar to <jsp:forward />
. How can we prevent the rest of the JSP page from executing from within the taglib?
Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.
Basically, we want to create a taglib that can possibly forward request execution to another page, similar to <jsp:forward />
. How can we prevent the rest of the JSP page from executing from within the taglib?
If you don’t want to continue processing the original page after passing control to another you are better off using a redirect rather than a forward.
This will redirect to the new page and stop processing the old one.
However - redirects are only usable if you have not written anything to the response body yet (i.e. not sent any data back to the client).
IllegalStateException: response already committed
troubles.For me the following lines worked quite well: