Including a JSP Page Programatically
- by Tom Tucker
I need to include a JSP page in a Tag class. I believe the standard way to include a JSP page within another JSP page using API is this:
request.getRequestDispatcher("included.jsp").include(request, response);
However, I noticed that the included page is rendered at the top of the generated page, no matter where the code is located. On the other hand, the <jsp:include> action works as expected, rendering the included page where the tag appears in the JSP file.
How do I include a JSP page in a class so that it behaves the same as the <jsp:include>? There's no way to invoke the <jsp:include> action within a Tag class, is there?