servlet Request Dispatcher path

Hi,

I was reading as below.


Request Dispatcher


After supplying a String, a path to the JSP file If the path begins with a slash, it is relative to the current context root
Otherwise, it is relative to the servlet location.
Then we do
view.forward(request, response);

After added the result information to the HttpRequest object forward the whole thing to the JSP


I have not understood relative path to servlet location vs relative path to current context root. What is the difference between them and when we use which one and what are advantages and disavantages of each one. What is the absolute path and when we use it.

Please advise.

Any links resources ideas highly appreciated. Thanks in advance
LVL 7
gudii9Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
Again, standard http

if your form action is
whatever.do
then if you use
/home.do
you will go to the root of your server and if you do
somewhere.do
you will be on the same path/"directory" as whatever.do
0
girionisCommented:
Lets say you're at the folder c:/mywebsite/payments/paypal/apayment.jsp and lets say that the url of your site is http://www.mywebsite.com. The context root is the c:/mywebsite.

If from the file apayment.jsp you do /invoices/myinvoice.jsp the server will try to read c:/mywebsite/invoices/myinvoice.jsp. This is called absolute path.

If you do invoice/myinvoice.jsp the server will try to read c:/mywebsite/payments/paypal/invoices/myinvoice.jsp. This is called relative path.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gudii9Author Commented:
>>>If you do invoice/myinvoice.jsp the server will try to read c:/mywebsite/payments/paypal/invoices/myinvoice.jsp. This is called relative path.



relative path seems not suitable for above requirement.

So relative means relative to the folder of the source page(apayment.jsp )

Please confirm
0
girionisCommented:
So relative means relative to the folder of the source page(apayment.jsp )
Yes.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.