Including a JSP Page Programatically

Posted by Tom Tucker on Stack Overflow See other posts from Stack Overflow or by Tom Tucker
Published on 2010-12-28T23:49:15Z Indexed on 2010/12/28 23:53 UTC
Read the original article Hit count: 404

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about jsp