aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Relative url ,Relative path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Relative url ,Relative path" Watch "Relative url ,Relative path" New topic
Author

Relative url ,Relative path

pallavi utukuri
Ranch Hand

Joined: Feb 10, 2004
Posts: 182
in HFS page 136 its given that relavite url's come in two flavours with and without "/"....but in page 204 its given that ("result.jsp") is a relative path as there is not initial forward slash "/" .....
i dont understand the difference between relative url and relative path


Thanks,<br />Pallavi
Kailas Lovlekar
Ranch Hand

Joined: Oct 25, 2004
Posts: 34
Pallavi, what's HFS?


SCJP/SCWCD/SCEA/OCA/Pega System Architect
Bahadar Khan
Ranch Hand

Joined: Jun 19, 2003
Posts: 81
Kailas,

HFS is referred to Head First Servlets and JSP book. A popular book with SCWCD audience.

Pallavi,

'/' means the code base of your application. When you see something like this

/result.jsp, this means that result.jsp is located inside your web application directory. In this case we assume this is "MyWebApp"
Iniside assume there is <WebPages> directory. Now inside there there are two .jsp pages, say, A.jsp and B.jsp

Here is the scheme.

MyWebApp/WebPages/A.jsp
MyWebApp/WebPages/B.jsp

and

MyWebApp/result.jsp

If you refer A.jsp from within B.jsp as "A.jsp", the container will look for A.jsp relative to the calling page. That is it will look in directory <WebPAges>

But

if you need to refer to the result.jsp from the same B.jsp page,
there are two ways,

"../result.jsp" that is, relative to current page

or secondly,

"/result.jsp" that is, relative to root of web application, in other words "MyWebApp". '/' represnts "MyWebApp".

Hope this might help. Let me know if you need further help on this.


cheer
-Bahadar
pallavi utukuri
Ranch Hand

Joined: Feb 10, 2004
Posts: 182
Thanks bahadar, that was good explanation......

i wanted to know
1.is there any difference between relative url and relative path ?

2.why is ("result.jsp") is a relative path not a relative url?
Bahadar Khan
Ranch Hand

Joined: Jun 19, 2003
Posts: 81
Pallavi,

I am not sure that there is any difference between relative path or relative URL. However, after some brain grinding there is a subtle difference and that is

: A relative path is a realistic fix pattren pointing to a resource
: A relative URL is however similar except that URL can be ficticious, meaning by it may contain name of some resource but that might be a logical naming. As an example look at <url-pattern> tag. This defines a logical mapping to a resource.

Though I am not very certain about my understanding of this. The purpose is to give some food of thought for other ranchers to come and discuss it. Anyways a brainy question :roll:


cheers
-Bahadar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Relative url ,Relative path