• Post Reply Bookmark Topic Watch Topic
  • New Topic

Simple question...relative URLs

 
Gill Clover
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • 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
 
Asher Tarnopolski
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • 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").
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!