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

difference bw jsp: include page and @ include file

Zeina Afif

Joined: Jul 19, 2001
Posts: 22
I have a main jsp file that redirects, depending on the request, the appropriate jsp file. I was using at first:
<%@ include file="d_AllProjects.jsp"%>
But I started getting the "Illegal target of jump or branch" error once I had more than 17 includes (using condition to select the appropriate one).
so I switched the code to build the filename as a string depending on the request and then used:
<jsp:include page="<%=filename%>"/>
It's working but there's a small delay when the page is being pulled. I'm also not sure which one is best to use.
Any advice on how to clean this up?
Many thanks!
chanoch wiggers
Ranch Hand

Joined: May 24, 2001
Posts: 245
Because this syntax is a little akward, you might consider creating a custom tag for it?

chanoch<p><a href="" target="_blank" rel="nofollow">Author of Professional Apache Tomcat</a></p>
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
In the <jsp:include ... > tag the page to be included is determined at runtime. As opposed to the <%@ include ...> tag which is done at compile time. So there will be more of a delay at runtime for the first one.
As far as the error you were getting when you have more than 17 includes I dont know why you'd be getting that. I would look at the 17th one you add and make sure the path info for it and all the spellings are correct.

Zeina Afif

Joined: Jul 19, 2001
Posts: 22
Thanks for replying.
I haven't used custom tags yet. (I haven't learned to yet...) I think after this demo this week, I'll try to rewrite some of my code and see what I could write in custom tags.
Dave, I know it sounds weird, but it's when I include any jsp file after the 17th condidion include, I get that error. It could be cause of some of the includes or references in the files...
I'm going to have to go back and 'clean up' and write some javabeans and custom tag. But to be honest, I don't know what should be in the javabean? Do you guys recommend any book or tutorial on the web on javabeans? and when best to use it? Everything I found on the web doesn't seem to apply to my project.
I am using MS SQL Server 7 for backend, and JRUN 3.1.
Thank you again!
I agree. Here's the link:
subject: difference bw jsp: include page and @ include file
It's not a secret anymore!