aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Absolute path , Relative Path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Absolute path , Relative Path " Watch "Absolute path , Relative Path " New topic
Author

Absolute path , Relative Path

Gagan Indus
Ranch Hand

Joined: Feb 28, 2001
Posts: 346
ServletContext's getRequestDispatcher method accepts only absolute paths, and not relative paths.
But ServletRequest's getRequestDispatcher method accepts both.
I am nt clear about wot is relative path and wot is absolute path
( One book says " absolute pathname shld begin wid a / " . but oh ! i thought it to be property of relative path? like when giving url's in html file? i seems totally out of sync )
Can anyone help clear my doubt.

------------------
Gagan (/^_^\) SCJP2
Die-hard JavaMonk -- little Java a day , keeps u going .


Gagan (/^_^\) SCJP2 SCWCD IBM486 <br />Die-hard JavaMonk -- little Java a day, keeps you going.<br /><a href="http://www.objectfirst.com/blog" target="_blank" rel="nofollow">My Blog</a>
Allan Moster
Ranch Hand

Joined: Sep 14, 2001
Posts: 153
"/" must be referring to canonical path. This is relative to the server's root directory.
I view it this way, if you specify a complete URL, then that's absolute. If you describe the path to a page relative to where the current page is, then that's relative.
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by Allan Moster:
"/" must be referring to canonical path. This is relative to the server's root directory.
Actually, RequestDispatchers work relative to the context root, i.e. the path to which the web application is mapped.
Why this the difference between ServletRequest.getRequestDispatcher() and ServletContext.getRequestDispatcher()? Remember that the ServletContext is associated with the web application as a whole. The RequestDispatcher it gives you cannot handle relative paths; what should they be relative to? The ServletRequest object, on the other hand, encapsulates a specific request. That's why it can make sense of a relative path: it has something the path can be relative to.
- Peter
Gagan Indus
Ranch Hand

Joined: Feb 28, 2001
Posts: 346
Thankx Allan , Peter
now i got , relative to wot they mean when they say 'relative'
------------------
Gagan (/^_^\) SCJP2
Die-hard JavaMonk -- little Java a day , keeps u going .
Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

Hi Gagan, this is an absolute URL http://www.javaranch.com/ubb/Forum18/HTML/000368.html
and "Image/cool.gif" may be a relative URL ..... here relative in terms of the home directory of the document that is referring to another uniform resource .....
Tell me which book u r mainly studying 4 these nice queries now-a-days in this forum....
------------------
Muhammad Ashikuzzaman (Fahim)
Sun Certified Programmer for the Java� 2 Platform
--When you learn something, learn it by heart!


Ashik Uzzaman
Senior Member of Technical Staff, Salesforce.com, San Francisco, CA, USA.
Gagan Indus
Ranch Hand

Joined: Feb 28, 2001
Posts: 346
Hi Ashik
thankx for ur relative/absolute path tip-off
i am reading Java-server-prog j2ee ed ( old edition ) by wrox , coz dis is only book i have
and sometimes i read servlet specs too , but reading on computer monitor annoy's me
anyway , which books/resources are u using ?

------------------
Gagan (/^_^\) SCJP2
Die-hard JavaMonk -- little Java a day , keeps u going .
Sreenivasa Majji
Ranch Hand

Joined: Jul 12, 2001
Posts: 224
Hi,
No offence to anybody. While reading some of the messages times I get a feeling that I am reading a coded message. I noticed some people use some cryptic words (ofcourse you won't find them in the dictionary) like wot, 4, cos, da, abt. I would rather skip the message than reading it. .
My $0.02
/Sreenivasa Kumar Majji.

Sreenivasa Majji
Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

Gagan, u'll get my book list and preparation list here .
originally posted by majji :

Hi,
No offence to anybody. While reading some of the messages times I get a feeling that I am reading a coded message. I noticed some people use some cryptic words (ofcourse you won't find them in the dictionary) like wot, 4, cos, da, abt. I would rather skip the message than reading it. .
My $0.02

Just to get some cultural touches and save some times we r coding our messages... ...anyway nice observation majji...but plz don't skip man....

------------------
Muhammad Ashikuzzaman (Fahim)
Sun Certified Programmer for the Java� 2 Platform
--When you learn something, learn it by heart!
[This message has been edited by Ashik uzzaman (edited October 28, 2001).]
Bal Sharma
Ranch Hand

Joined: Sep 19, 2001
Posts: 273
How do you get cultural touch using coded message? Alash! You guys have attached compiler to decode your language. Your post doesn't cover only one sector OR only one specific area. Once you publish, it is for all people of this planet who serf these pageses. Please be kind to us. Try to hlep us what you mean? If you really love coding message why don't email only those who loves it? Why for others?
OK I WRTE?
WOT U DD I DUNO BT I DDNT LKE IT. ITS VVVVRY PAINFUL. IF PSSBL TRY 2 WRT PLN ANLISH. EVBDY UNDRSTD PLN ANLISH. NT COD MSG. ALL PPL R NT JMS BND 007.
Do you understand it? How long did it take to decode my message? Did you have fun decoding it? If everybody start writing this way my dear who gonna come back JAVARANCH? AaHa! I saved typing and I added cultural felling too? Didn't I?
If you guys are trying to invent new language and JavaRanch supports it. Forget about it, discard this message, I do not have to say anything? I will just discard your message whatever it is, professionally how good it is? it does'nt matter. I will simply discard message when I see familiar code authour's name. I completely agree with Ashik uzzaman. I will not skip man....
Thanks. BK
[i]
Just to get some cultural touches and save some times we r coding our messages... ...anyway nice observation majji...but plz don't skip man....
[/B]

Sreenivasa Majji
Ranch Hand

Joined: Jul 12, 2001
Posts: 224
Thanks bala. At least I am not the only one who feels in this way. I don't understand how much time we save by typing "r" instead of "are".
/Sreenivasa Kumar Majji.
[This message has been edited by sreenivasa majji (edited October 28, 2001).]
Bal Sharma
Ranch Hand

Joined: Sep 19, 2001
Posts: 273
YOU ARE WELCOME. What you said was absolutely right. BK
Originally posted by sreenivasa majji:
Thanks bala. At least I am not the only one who feels in this way. I don't understand how much time we save by "r" instead of "are".
/Sreenivasa Kumar Majji.

Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

originally posted by Bal Sharma :

OK I WRTE?
WOT U DD I DUNO BT I DDNT LKE IT. ITS VVVVRY PAINFUL. IF PSSBL TRY 2 WRT PLN ANLISH. EVBDY UNDRSTD PLN ANLISH. NT COD MSG. ALL PPL R NT JMS BND 007.

....excellent Sharma...u can do it better than others...

I will simply discard message when I see familiar code authour's name. I completely agree with Ashik uzzaman. I will not skip man....

So you are not skipping man....thanks...

------------------
Muhammad Ashikuzzaman (Fahim)
Sun Certified Programmer for the Java� 2 Platform
--When you learn something, learn it by heart!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Absolute path , Relative Path