File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes creating a template jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "creating a template jsp page" Watch "creating a template jsp page" New topic

creating a template jsp page

Maxim Katcharov
Ranch Hand

Joined: Sep 07, 2004
Posts: 113
I have a 'template' jsp, into which I'd like to insert the output of another jsp. However, this isn't as simple as

since I don't want to hard code the page that I'm including. I could of course do the following:

but I would much rather just add something like

to the template page. Unfortunatley, this isn't allowed. So I tried

as a hack. Unfortunatley, I don't seem to know what I'm doing anymore (if I ever did), since this either spits out directly after the last normal include action, or throws a "getOutputStream() has already been called for this response".

The real question here is, how do I make a template into which I can toss various types of content? (without creating two files, making the code illegible, or making it not work at all)
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858

or better yet, check out the <c:import> tag of the JSTL.

[Asking smart questions] [About Bear] [Books by Bear]
Maxim Katcharov
Ranch Hand

Joined: Sep 07, 2004
Posts: 113
Thank you, I didn't know that that could be done. And thanks for the tip, I'll look it up.
I agree. Here's the link:
subject: creating a template jsp page
It's not a secret anymore!