Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

should I use relative or absolute URLs?  RSS feed

 
Pankaj Pandey
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I have attached the project hierarchy of eclipse . If i want to access a html page in the web-contents directory from the scr/package directory , which path i should use relative or absolute . Can you please explain thw absolute and relative path with the reference of attached project .

Thanks,
Capture.PNG
[Thumbnail for Capture.PNG]
Project hierachy
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pankaj Pandey wrote:If i want to access a html page in the web-contents directory from the scr/package directory

What do mean by referenced from the src/package directory? Reference how? I assume that folder contains Java sources, and as such it is not part of the deployed hierarchy.

What are you actuality trying to do?
 
Pankaj Pandey
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear ,

I am new to eclipse so was a bit confused . I have attached the directory structure . The WEB-INF directory contains my servlet classes(\wtpwebapps\HelloServlet\WEB-INF\classes\com\java\training) . On the same level of WEB-INF i have two html pages . So if i want to access these two html pages from the servlet class which path should i refer to - Absolute or Relative . Can you please explain the difference .

Thanks
servlet.PNG
[Thumbnail for servlet.PNG]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That greatly depends upon what you are doing in the servlet with respect to the HTML pages.

Are you forwarding to them? If so, then you need to use a context-relative reference.

You never reference anything relative to the directory of a servlet.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.S. See the entry in the ServletsFaq named "Types of Paths" .
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!