We say some methods do not accept relative paths. Does that mean these methods do not accept page-relative/file-relative paths but accept context-relative paths ? Please elaborate the difference between relative and absolute paths...
Amit, An absolute path contains the full URL of the item being referenced. A relative path contains directions to the item relative to the HTML page. For example: Let's say that we have a directory structure that looks like the following + development - images - jsp Now let's say that index.jsp is in the development folder. Index.jsp is simply a redirect page to a file called home.jsp in the jsp folder. This redirect can be accomplished in two ways. First by using a relative path, meaning that, given the page/file current location use ../ or / (move up directory or move down directory) to access the contents of another directory. In this case, since we're trying to call home.jsp by using a relative path from index.jsp in the development folder we would say: redirect(/jsp/home.jsp); The other means is the absolute path, which is simply the complete URL location need to locate the page/file. In this case we would say: redirect(http://myServer.com/development/jsp/home.jsp); hope this helps. -PP
posted 18 years ago
Thanx PP, Just one more question. How do we specify the path of the file which is in the parent directory of the development folder ( in ur example ). Do we specify it like this-- redirect("../testing/test.jsp"); where 'testing' is in the same folder as 'development' and 'test.jsp' is a file under 'testing'.
posted 18 years ago
Any tips to remember which methods of the Servlet API accept only relative paths or only absolute paths as parameters ?
I am going through APIs .... till now I think only ServletRequest.getRequestDispathcher() takes relative path. Other methods take absolute path i.e. paths starting with "/" which is taken as relative to context of the web-app. CMIW (Correct Me if I am Wrong)
"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
It wasn't my idea to go to some crazy nightclub in the middle of nowhere. I just wanted to stay home and cuddle with this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!