Google 網路論壇不再支援新的 Usenet 貼文或訂閱項目,但過往內容仍可供查看。

JSP Includes HTML file residing outside WebApp

瀏覽次數:1 次
跳到第一則未讀訊息

Oleg Konovalov

未讀,
2004年3月27日 凌晨12:13:032004/3/27
收件者:
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


Jeff Schwab

未讀,
2004年3月27日 清晨6:41:362004/3/27
收件者:


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.

0 則新訊息