• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Simple question...relative URLs

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
I am developing a web application using servlets on my home machine but need to transfer it to a different computer for demonstration. As much as possible I am using relative URLs in my servlets when e.g. submitting forms to make this process straightforward.
However, I also have some static HTML pages that point to servlets and vice versa - these are located in a different directory than the servlet class files obviously. (I'm using Tomcat so the HTML files are in tomcat_home/webapps/ ROOT and the servlets in ...ROOT/WEB-INF/
classes/package_name). I can't seem to make either the HTML file or the servlet point to each other using relative URLs and so have to use the full URLs in each case.
I've tried various things but nothing works except a full URL - I would think that using a relative URL is possible, could someone tell me what I should write as my relative URL (in both directions - from the HTML file to a servlet and vice versa).
Much appreciated!
Gillian Klee
 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
brbrb,
let's say you open in your ROOT directory folder called HTML. if you place your html files there they are visible for servlets (f.e. "/HTML/blabla.html"), and servlets are visible for your html files (f.e. "/servlet/blapackage.BlaBlaServlet").
 
Watchya got in that poodle gun? Anything for me? Or this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic