aspose file tools*
The moose likes Servlets and the fly likes jsp:include---please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "jsp:include---please help" Watch "jsp:include---please help" New topic
Author

jsp:include---please help

Sam Zheng
Ranch Hand

Joined: Nov 29, 2000
Posts: 61
I have been beating my chest trying to fix this in vain. Please
help! Here is my problem.
In my jsp file, I have a jsp (under webdev\jsp) include:
<jsp:include page="http://localhost:8080/webdev/servlet/Counter"
flush="true" />
Here "Counter" is a servlet which will output a number.
But the above jsp:include doesn't seem to output anything,
not even an error message. I tried to use the absolute
path such as "C:\tomcat\webapps\webdev\web-inf\classes\Counter",
but it outputed nothing either. What did I do wrong?
BTW, I am running tomcat.
Thanks! Sam
Phil Hanna
Ranch Hand

Joined: Apr 05, 2001
Posts: 118
The answer is easy to find in the JSP specification. Look up the <jsp:include> syntax. It says that the value of the page attribute has to be a relative URL specification, either "/something", which is interpreted as starting at the root of the servlet context, or "somethingElse", which is relative to the current JSP page. URL's like "http://..." and "C:/..." don't work.


Phil Hanna<BR>Sun Certified Programmer for the Java 2 Platform<BR>Author of :<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072127686/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072124253/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">Instant Java Servlets</A>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp:include---please help
 
Similar Threads
problem using bean in jsp file
HF: JSP & Servlets, compiling on Windows
Error: Invalid jsp:include Tag
Help with directory tree in JSP/Servlet
HF: JSP & Servlets (Can't compile my first class on Windows)