User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 426,575 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,651 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting

<jsp:include> Not Printing On Web Page, But In Source Code

Join Date: Sep 2006
Location: Chicago, IL
Posts: 4
Reputation: CabriniGreens is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
CabriniGreens CabriniGreens is offline Offline
Newbie Poster

Help Re: <jsp:include> Not Printing On Web Page, But In Source Code

  #4  
Sep 27th, 2006
Well,
I thought I'd figured it out, but it seems that includes DO NOT work within any pages that are not at the root level. Within a page two directories down from the root level (/admin/admin.jsp), none of the following single statements work:

<jsp:include page="/inc/global_header.jsp" flush="true" />
or
<jsp:include page="../../inc/global_header.jsp" flush="true" />
or
<jsp:include page="/home/projects/www.website.com/htdocs/inc/global_header.jsp" flush="true" />
or
<%@ include file="/inc/global_header.jsp" %>
or
<%@ include file="../../inc/global_header.jsp" %>
or
<%@ include file="/home/projects/www.website.com/htdocs/inc/global_header.jsp" %>


I have this setup in the Tomcat "server.xml" file:

<Host name="www.website.com" debug="0" appBase="/home/projects/www.website.com/htdocs">
<Context path="" docBase="/home/projects/www.website.com/htdocs" debug="0" reloadable="true">
</Context>


This is a sample of errors with "../../":

org.apache.jasper.JasperException: /admin/admin.jsp(27,0) File "/admin/../../inc/global_header.jsp" not found
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.JasperException: /admin/admin.jsp(27,0) File "/admin/../../inc/global_header.jsp" not found
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
    org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:339)
    org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:372)
    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:484)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552)
    org.apache.jasper.compiler.Parser.parse(Parser.java:126)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


And his is a sample of errors with "/":

org.apache.jasper.JasperException: /admin/admin.jsp(27,0) File "/inc/global_header.jsp" not found
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.JasperException: /admin/admin.jsp(27,0) File "/inc/global_header.jsp" not found
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
    org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:339)
    org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:372)
    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:484)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552)
    org.apache.jasper.compiler.Parser.parse(Parser.java:126)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


Can anyone tell me what's wrong? I don't understand why I cannot include files within files that DO NOT reside at the root level.


Thanks so much in advance,
CabG
Reply With Quote  
All times are GMT -4. The time now is 9:44 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC