• Post Reply Bookmark Topic Watch Topic
  • New Topic

linking problem with servlets  RSS feed

 
Adrian Cruickshank
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I only started learning how to program last September so sorry if my question is dumb!
I am writing a servlet, running on an internal server, to process a user's input to a form and to output another form to the client.
I want this form to include links to other static html pages, and I had the code shown below:
out.println("<td><a href=\"H://Summer Proj/myHTML/Contents2.html\">
<strong>BookContents</strong></a></td>");
However, when I put this on a public server I need to reference the file with a relative address and I've been having trouble figuring out how to do this.
The directory heirarchy I have at the moment is:
h -> Summer Proj -> myServlets -> WEB-INF -> classes -> MyClasses.class

-> myHTML -> myHTMLfiles.html
When I try referencing the file by going up the directory from the class file, e.g:
../../../myHTML/Contents2.html
the url it shows in the status bar is:
http://localhost:8081/myHTML/Contents2.html
and I get the message:
The requested resource (/myHTML/Contents2.html) is not available.
I've tried other code and moving the myHTML file but I don't really have a clue what I'm doing.
I know I probably sound like I'm out of my depth here but all the code works and the only problem I've got left is this and I'm really frustrated with it! Any help or advice would really be appreciated.
 
Adrian Cruickshank
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry - in my previous message the directory heirarchy got messed up - myHTML and myServlets are both in Summer Proj!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!