By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,204 Members | 1,212 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,204 IT Pros & Developers. It's quick & easy.

JSP Includes HTML file residing outside WebApp

P: n/a
Hi,
We have an application which is a Java/JSP security wrapper to
control access to the contents of the external corporate training Web site
(courses).
It is a Java/JSP/Struts application which was originally
developed on Windows and deployed on Tomcat4.1.

As of today, the contents (HTML/Flash) is residing inside
the application itself: (webapps)/myApp/myData

We found out that the client is planning to deployed
in a strict secure hosting environment (Unix, Weblogic7, iPlanet web
server).
One of their requirements is that Application (JSP, Java classes,
Javascript)
will reside on AppServer, and all static contents (HTML, Flash, GIFs) on Web
server.
So now we need to separate myData from myApp (they will be on the same
level).
The way it is built now is that for each course has a JSP file (say,
course1.jsp)
which has a line: <%@ include file="course1.html" %>

The problem is that now HTML files will be outside of application
("/myData/courses/course1.html"),
but JSP pages still inside of the Web application.

We tried to provide a relative path (e.g. "/myData/courses/course1.html",
or "../myData/courses/course1.html"),
full URL ("http:/www.mycomp.com/myData/courses/course1.html"),
but include doesn't work - getting exceptions.

What would you recommend to include inside JSP the HTML file residing
outside of Java application ?
Thank you in advance,
Oleg.
cell: 609-933-4906
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Oleg Konovalov wrote:
Hi,
We have an application which is a Java/JSP security wrapper to
control access to the contents of the external corporate training Web site
(courses).
It is a Java/JSP/Struts application which was originally
developed on Windows and deployed on Tomcat4.1.

As of today, the contents (HTML/Flash) is residing inside
the application itself: (webapps)/myApp/myData

We found out that the client is planning to deployed
in a strict secure hosting environment (Unix, Weblogic7, iPlanet web
server).
One of their requirements is that Application (JSP, Java classes,
Javascript)
will reside on AppServer, and all static contents (HTML, Flash, GIFs) on Web
server.
So now we need to separate myData from myApp (they will be on the same
level).
The way it is built now is that for each course has a JSP file (say,
course1.jsp)
which has a line: <%@ include file="course1.html" %>

The problem is that now HTML files will be outside of application
("/myData/courses/course1.html"),
but JSP pages still inside of the Web application.

We tried to provide a relative path (e.g. "/myData/courses/course1.html",
or "../myData/courses/course1.html"),
full URL ("http:/www.mycomp.com/myData/courses/course1.html"),
but include doesn't work - getting exceptions.

What would you recommend to include inside JSP the HTML file residing
outside of Java application ?
Thank you in advance,
Oleg.
cell: 609-933-4906

I've removed comp.lang.java.gui, since this seems blindingly OT there.

Inside your servlet, call "getServletContext().getRealPath()". This
should give you an actual path on the local server, whence you can
derive a relative path to the static data for use in your JSP.
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.