Context path gets lost
843840Sep 27 2007 — edited Oct 10 2007Hello all,
I have this problem with the context path getting lost. I have a directory structure like this.
4 pages in my /project directory (login.jsp, index.html...)
other JSP files in subdirectories of that directory.
In my files I use static paths all like this <%@ include file="/project/arrangements/bookings.jsp" %>
When I'm in JDeveloper and I set my context path to testContext and then launch my application, everything works fine. But when I try to access a JSP file from a subdirectory, he doesnt add the context path after the ip adress.
He tries to access :
http://10.0.0.188:8990/project/bookings.jsp
instead of
http://10.0.0.188:8990/testContext/project/bookings.jsp
So in one way or another, pages in the subdirectory don't add the context path to their link.
Now I found a way to solve this problem, I use request.getContextPath() before each static link, now this would solve everything, I tried it and it works,
but now another problem rises. In my pages, I have some static paths like this
<%@ page
language="java"
import="oracle.jbo.*, be.company.dbwise.jbo.*"
session="true"
autoFlush="true"
isThreadSafe="true"
contentType="text/html; charset=ISO-8859-1"
errorPage="/project/common/jsp/errorpage.jsp"
isErrorPage="false"
%>
When I replace the errorPage="/project/common/jsp/errorpage.jsp" with either errorPage="<%=request.getContextPath()%>/project/common/jsp/errorpage.jsp" or errorPage= request.getContextPath() + "/project/common/jsp/errorpage.jsp" it doesn't compile.
Can anyone tell me what I'm doing wrong for any of my problems or preferably the first one.
Thanks in advance!