Lew wrote:
Venkatesh wrote:
I have a question related to JSPs. We have few JSP files and HTML files
in our webapp. The JSP files have jsp:include directives to include
different HTML files. Now we plan to shift all HTML files to a
different location - machine having apache installed (might be on same
host or on different host). In this case, how can we include the HTML
files into our JSP using jsp:include ??? Since all files were together
till now, I was accessing the HTML files using relative paths, but now
I'm not knowing about how to access the HTML files. Request somebody
who has knowledge about this to help me solve this problem.
In the first place, having to hard-code URLs into an application is bad
practice. Strongly resist putting absolute URLs inside your application code.
Doing so ties the application to one particular environment.
You can set up Apache to forward URLs of a certain pattern to another host or
directory. So you could keep your original relative paths and let the
deployment figure out whence to retrieve them.
The larger question is how it possibly makes sense to divide applications
where HTML files come from a separate logical host. Methinks this decision
requires more careful analysis and later rejection. From the point of view of
the application, all such resources should be local to the application.
Consider the WAR file that would install this app. Would it lack the HTML files?
- Lew
HI Lew,
The way our application is structured is - JSPs form a framework, and
when this framework is combined with assets - like images, html part
files, the site will come up.
The assets are created by 3rd party and not by us ... and we don't want
to expose the application war to them. Infact the idea is to upload the
assets into their servers and access from there directly. It is
basically the business factor driving for this divison.
Thank you,
Venkatesh
Please don't top-post...
Well, for images, you wouldn't use a jsp:include.
Actually, jsp:include ONLY works for local files. You would be better
off running behind Apache, and using virtual includes.
src='image.gif'> format.
You might also look into a content-management solution instead.