Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes a recursive include? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "a recursive include?" Watch "a recursive include?" New topic
Author

a recursive include?

paul sun
Greenhorn

Joined: Dec 22, 2000
Posts: 28
The sample jsp file like this:
...
<%@ include file="spacer.html" %>
<%@ include file="menu.html" %>
<%@ include file="spacer.html %>
<%@ include file="content.html" %>
...
When running this code, I got an error saying following:
"org.apache.jasper.compiler.ParseException: Seen file /spacer.html already, maybe this is a recursive include?!"
When I remove one of <%@ include file="spacer.html" %>, it runs successfully.
Does it means I can not include two or more same included files?
How should I do if I want to include more than one same file?
Thanks.
Amit Roy
Ranch Hand

Joined: Oct 10, 2000
Posts: 132
hi Paul
ya u cannot include the same file more then once. Alos the name of all the variables will clash
Amit


<I>Chance Favours the Prepared minds"</I>
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Paul,
Use the other type include. Use <jsp:include ... as many times as you like.

regds
maha anna
[This message has been edited by maha anna (edited April 01, 2001).]
paul sun
Greenhorn

Joined: Dec 22, 2000
Posts: 28
Amit, thank you,
When using the jsp file with the repeated <%@include ...%>, it works with my computer; however, when moving the same file to webappcabaret.com, I got the above error. Both run on the Tomcat. I don't know why. Now I remove all the repeated <%@include ...%> in my jsp files to make the codes adaptive to any host.
Maha, thank you,
When I use <jsp:include page="something" flush="true" /> (not repeated) many times in a jsp file, sometimes I get an error "response already committed!". After removing some, better only one left, it runs happy. I read servlet and jsp specs, both say the RequestDispatcher's include and <jsp:include.../> have restriction to be used. . How can we avoid the "IllegalStateException" when dealing with <jsp:include .../>?
Thanks again.

[This message has been edited by paul sun (edited April 01, 2001).]
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Paul,
Try to make autoflush="false" for your <@ page ... directive and check.
regds
maha anna
paul sun
Greenhorn

Joined: Dec 22, 2000
Posts: 28
Thanks Maha
Hava a nice day!
Paul Sun
 
 
subject: a recursive include?
 
Similar Threads
What's this parseException
include a actionlistener class in applet tags
the answer is not right?
include directive - path of file
Does c:import tag cache the page.