Include path

This should be simple. My application has this structure:

WEB-INF

-jsp

--inc

I have a jsp in the WEB-INF/jsp directory hat has the following:

<%@ include file="/jsp/inc/_header.jsp" %>

This gets me an exception because _header.jsp is not found. Nor is the simpler

<%@ include file="/inc/_header.jsp" %>

found. I'm sure that _header.jsp is in the inc directory. What am I missing? Thanks.WEB-INF

-jsp

--inc

[485 byte] By [klitwaka] at [2007-10-2 14:15:38]
# 1

This is from the include directive's syntax card:

"If the relative URL starts with /, the path is relative to the JSP application's context, which is a javax.servlet.ServletContext object that is in turn stored in the application object. If the relative URL starts with a directory or file name, the path is relative to the JSP page."

So if you start the URL with a "/" (like you do in the post above) the URL should be: "/WEB-INF/jsp/inc/_header.jsp", since that is the relative address from the servlet context root.

But what you really want to try, I think, is to take the "/" out and just make the page relative to the current page: "inc/_header.jsp".

Syntax cards can be found here:

http://java.sun.com/products/jsp/syntax/2.0/syntaxref20.html

stevejlukea at 2007-7-13 12:31:22 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...