Including jsps/html files from remote host into our JSP

Discussion in 'Java' started by Venkatesh, Dec 16, 2006.

  1. Venkatesh

    Venkatesh Guest

    Hello All,

    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.

    Thank you,
    Venkatesh
    Venkatesh, Dec 16, 2006
    #1
    1. Advertising

  2. Venkatesh

    Venkatesh Guest

    Just wanted to add:

    Our app server is Tomcat 4.1.30, and JSP version is JSP 1.2

    Thank you,
    Venkatesh

    Venkatesh wrote:
    > Hello All,
    >
    > 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.
    >
    > Thank you,
    > Venkatesh
    Venkatesh, Dec 16, 2006
    #2
    1. Advertising

  3. Venkatesh

    Lew Guest

    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
    Lew, Dec 16, 2006
    #3
  4. Venkatesh

    Venkatesh Guest

    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

    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
    Venkatesh, Dec 19, 2006
    #4
  5. Venkatesh

    Daniel Pitts Guest

    Venkatesh wrote:
    > 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.

    Although, images wouldn't be jsp:included anyway, as they are <img
    src='image.gif'> format.

    You might also look into a content-management solution instead.
    Databases and search indexes aren't new technology.
    Daniel Pitts, Dec 19, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ralf Koms

    [JSP]: Including HTM files

    Ralf Koms, Oct 11, 2004, in forum: Java
    Replies:
    1
    Views:
    351
    Ralf Koms
    Oct 11, 2004
  2. Tim B
    Replies:
    1
    Views:
    3,041
    Vitamines
    Feb 12, 2006
  3. Steve

    Good web host for JSPs?

    Steve, Mar 2, 2006, in forum: Java
    Replies:
    8
    Views:
    444
    Roedy Green
    Mar 5, 2006
  4. harryos
    Replies:
    2
    Views:
    2,053
    harryos
    Dec 3, 2008
  5. Ralf Koms
    Replies:
    4
    Views:
    142
    Ralf Koms
    Oct 12, 2004
Loading...

Share This Page