|
Hi
Shankar
I
don't know JSP at all but your include problem is a common. If JSP includes work
like most other environments, what is actually happening is that your included
file is replacing your include statement. So if you refer to "images/image1.gif"
in top.jsp, that same path is going to be used in
mission.jsp
Is
there an equivalent in jsp to $DOCUMENT_ROOT in php? This gives you the
full path to the current file, that way your full path is calculated dynamically
which will work for your production enviroment.
Another option is to set the full path some where,
database, include file, application session and append it to your includes. This
variable is then a setting that must be changed when you move to production.
etc.
Hope
that was clear.
Adi
Hello,
Sorry for a long mail. Please help me with this.
Problem: -------- Our company has lot of
small teams developing websites. we use a central jsp engine(tomcat) for
development. In order to refer to pages we use relative paths and it is
causing problems. this is the situation.
This is our file structure.
c:\programs\jrun\data\projects\proj1 c:\programs\jrun\data\projects\proj1\index.jsp c:\programs\jrun\data\projects\proj1\Top.jsp c:\programs\jrun\data\projects\proj1\images\image1.gif c:\programs\jrun\data\projects\proj1\aboutus\mission.jsp
top.jsp is used by all the pages thru out the
project. index.jsp includes top.jsp as <%@ include file="Top.jsp"
%> and Top.jsp has reference to image1.gif as <img width=600
height=25 src="images/image1.gif"> mission.jsp includes top.jsp as
<%@ include file="Top.jsp" %> but this causes a problem - the
image1.gif gets referenced in mission.jsp as <img width=600 height=25
src="images/image1.gif"> and thats a wrong path and the image is not
shown.
Work around: ------------ So we decided
to use absolute paths. now that causes an entirely different
problem.
Problem with
workaround: ----------------------- When we refer to other pages with
absolute paths, we have to specify the whole
"/projects/proj1/....."(c:\programs\jrun\data is the root), but this is not
the path that will be in production. Using virtual directories is also
ruled out as we have to mention the virtual directory name in the file
path.
Does anybody have a different approach we can
use.
Solution being
considered: -------------------------- One of things we were thinking is
modifying tomcat code to replace the path of all files to the absolute path at
runtime.
thanks,
Shankar
|