problems with include directive
hello, can anybody help me. I want to use the include directive with JSP in Tomcat 4.0.3. Therefore I want to use the relative path. For example if I use the relative path for: it works, but if I want to include: <%@ include file="/examples/jsp/include/foo.jsp" %> I get the error file not found. Does anybody hnow why and how I could solve this problem? I am using Apache 1.3 and Tomcat 4.0.3. Do I have to make an entry in Tomcats server.xml or web.xml so that the relative paths are found? Regards, Steffi Richter === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
Re: problems with include directive
Dear Stefanie, Include file takes absolute path and not virtual path. The path you are giving is virtual which is used by webserver to show the content. But in case of include directives in jsp it is the job of jsp engine to resolve them and it uses absolute paths only. -Original Message- From: Richter, Stefanie (Student Assistant) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 22, 2002 1:05 PM To: [EMAIL PROTECTED] Subject: problems with include directive hello, can anybody help me. I want to use the include directive with JSP in Tomcat 4.0.3. Therefore I want to use the relative path. For example if I use the relative path for: it works, but if I want to include: <%@ include file="/examples/jsp/include/foo.jsp" %> I get the error file not found. Does anybody hnow why and how I could solve this problem? I am using Apache 1.3 and Tomcat 4.0.3. Do I have to make an entry in Tomcats server.xml or web.xml so that the relative paths are found? Regards, Steffi Richter === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com ==To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
Re: problems with include directive
Thank you! so if I have to set the absolute path how can I do it? Do I have to modify the server.xml of tomcat or use the absolute path in JSP include tag? Because I tried to set the absolute path in the JSP tag and got the error: org.apache.jasper.compiler.CompileException: /home_user_test_absolute_path.jsp(23,5) File "C:/Program Files/Apache Tomcat 4.0/webapps/docuinfo/heading_menue.jsp" not found at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEve ntListener.java:782) I guess I have to modify something, do I? Thanks anyway. Regards, Steffi -Original Message- From: Bhushan_Bhangale [mailto:[EMAIL PROTECTED]] Sent: Mittwoch, 22. Mai 2002 10:03 To: [EMAIL PROTECTED] Subject: Re: problems with include directive Dear Stefanie, Include file takes absolute path and not virtual path. The path you are giving is virtual which is used by webserver to show the content. But in case of include directives in jsp it is the job of jsp engine to resolve them and it uses absolute paths only. -Original Message- From: Richter, Stefanie (Student Assistant) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 22, 2002 1:05 PM To: [EMAIL PROTECTED] Subject: problems with include directive hello, can anybody help me. I want to use the include directive with JSP in Tomcat 4.0.3. Therefore I want to use the relative path. For example if I use the relative path for: it works, but if I want to include: <%@ include file="/examples/jsp/include/foo.jsp" %> I get the error file not found. Does anybody hnow why and how I could solve this problem? I am using Apache 1.3 and Tomcat 4.0.3. Do I have to make an entry in Tomcats server.xml or web.xml so that the relative paths are found? Regards, Steffi Richter === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com ==To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
Re: problems with include directive
No need to modify server.xml It should work fine. Try ./filename or ../filename concept instead of starting from C:/ -Original Message- From: Richter, Stefanie (Student Assistant) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 22, 2002 1:54 PM To: [EMAIL PROTECTED] Subject: Re: problems with include directive Thank you! so if I have to set the absolute path how can I do it? Do I have to modify the server.xml of tomcat or use the absolute path in JSP include tag? Because I tried to set the absolute path in the JSP tag and got the error: org.apache.jasper.compiler.CompileException: /home_user_test_absolute_path.jsp(23,5) File "C:/Program Files/Apache Tomcat 4.0/webapps/docuinfo/heading_menue.jsp" not found at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEve ntListener.java:782) I guess I have to modify something, do I? Thanks anyway. Regards, Steffi -Original Message- From: Bhushan_Bhangale [mailto:[EMAIL PROTECTED]] Sent: Mittwoch, 22. Mai 2002 10:03 To: [EMAIL PROTECTED] Subject: Re: problems with include directive Dear Stefanie, Include file takes absolute path and not virtual path. The path you are giving is virtual which is used by webserver to show the content. But in case of include directives in jsp it is the job of jsp engine to resolve them and it uses absolute paths only. -Original Message- From: Richter, Stefanie (Student Assistant) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 22, 2002 1:05 PM To: [EMAIL PROTECTED] Subject: problems with include directive hello, can anybody help me. I want to use the include directive with JSP in Tomcat 4.0.3. Therefore I want to use the relative path. For example if I use the relative path for: it works, but if I want to include: <%@ include file="/examples/jsp/include/foo.jsp" %> I get the error file not found. Does anybody hnow why and how I could solve this problem? I am using Apache 1.3 and Tomcat 4.0.3. Do I have to make an entry in Tomcats server.xml or web.xml so that the relative paths are found? Regards, Steffi Richter === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com ==To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com ==To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
Re: problems with include directive
Richter, Stefanie (Student Assistant) wrote: > hello, > can anybody help me. > I want to use the include directive with JSP in Tomcat 4.0.3. Therefore I > want to use the relative path. > > For example if I use the relative path for: src="/examples/images/code.gif"> it works, but if I want to include: > <%@ include file="/examples/jsp/include/foo.jsp" %> > I get the error file not found. > Does anybody hnow why and how I could solve this problem? > [...] There are two types of paths you need to be aware of when using JSP: paths in HTML elements and paths in JSP elements. The main difference between them has to do with the "context path", i.e. the first part of a URI that is used to identify a specific web application. In the default Tomcat configuration, for instance, all examples are installed as a web application with the context path "/examples". A path in an HTML element (, , , etc.) is interpreted by the browser. The browser knows nothing about context paths. You can use an absolute path, i.e. the full path from the server down to the file, including the context path: "/examples/images/code.gif", for a file located under the "images" directory in a web application with the context path "/examples". You can also use a path that's relative to the URL used to request it: "code.gif", for a file located in the same directory as the page that contains it, "../code.gif" for a file that is in the parent directory of the page that contains it, etc. A path in JSP element (<%@ include %>, , ) is interpreted by the JSP container, and it knows about the context path. You must therefore use a path that's either relative to the context path for the application, or relative to the page that contains it. A context-relative path starts with a slash and is interpreted as relative to the context path: "/jsp/include/foo.jsp" for a file located under the "jsp/include" directory in a web application with the context path "/examples". Page-relatiave paths are the same as for page-relative paths in HTML elements. I hope this helps, Hans -- Hans Bergsten [EMAIL PROTECTED] Gefion Software http://www.gefionsoftware.com JavaServer Pageshttp://TheJSPBook.com === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
problems with include directive in tomcat
Greetings, I seem to be facing a small problem for which I'm not sure if it is related to Tomcat 3.1. In my JSP page I have included a scriptlet <%@ include file="HLine.html" %> multiple times in my code. Basically, this scriplet just includes the html file that simply draws a horizontal line across the screen with the html tag . I did this because I wanted the reduce the cluttering of my code. However, when I tried to invoke the page, tomcat gave me the following errors. org.apache.jasper.compiler.ParseException: Seen file \HLine.html already, maybe this is a recursive include?! at org.apache.jasper.compiler.JspReader.pushFile(JspReader.java, Compiled Code) at org.apache.jasper.compiler.JspReader.pushFile(JspReader.java:127) at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEve ntListener.java, Compiled Code) at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingList ener.java:116) at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java, Compiled Code) at org.apache.jasper.compiler.Parser.parse(Parser.java, Compiled Code) at org.apache.jasper.compiler.Parser.parse(Parser.java:1038) at org.apache.jasper.compiler.Parser.parse(Parser.java:1034) at org.apache.jasper.compiler.Compiler.compile(Compiler.java, Compiled Code) at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413) at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspSe rvlet.java:149) at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja va:161) at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261) at org.apache.jasper.runtime.JspServlet.service(JspServlet.java, Compiled Code) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java, Compiled Code) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:160) at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338 ) at java.lang.Thread.run(Thread.java:479) Is this a limitation of the product where it prohibits you to include a file multiple times in a JSP page? When I ran this code with jswdkv1.0.1, the code worked fine. If anyone has faced this situation before, please let me know. Cheers Henry Hooi === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets