aspose file tools*
The moose likes JSP and the fly likes How to specify Servlet path in JSP? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

How to specify Servlet path in JSP?

K Aditi
Ranch Hand

Joined: Mar 17, 2008
Posts: 89
This is with regard to specifying Servlet paths in JSP...
How to specify paths in the action attribute?
e.g. What does the path indicated in bold indicate?
<form name="frmEmpAcc" action = "../../FloatingEmployeeAccess" method="Post">

I mean what does . , .., /.. etc. indicate?


Aditi
vijay shanker
Ranch Hand

Joined: Oct 26, 2007
Posts: 88
When you're creating links to documents and images on the Web, you need to think about how you're going to link to them. There are two standard ways to create links:
* absolute paths
* relative paths

Absolute paths are called that because they refer to the very specific location, including the domain name. The absolute path to a Web element is also often referred to as the URL. For example, the absolute path to this Web page is: http:/abc.com/home/room/bed.htm


Relative paths change depending upon what page the links are located on. There are several rules to creating a link using the relative path:
* links in the same directory as the page have no path information listed
filename
* sub-directories are listed without any preceding slashes
weekly/filename
* links up one directory are listed as
../filename

How to determine the relative path:

1. Determine the location of the page you are editing.
This article is located in the/library/weekly folder on my site.
2. Determine the location of the page or image you want to link to.
The Beginner's Resource Center is located here: /library/beginning/
3. Compare the locations and to decide how to point to it
From this article, I would need to step up one directory (to/library) and then go back down to the beginning directory
4. Write the link using the rules listed above:
<a href="../beginning/bl_begin.htm"> ...</a>
K Aditi
Ranch Hand

Joined: Mar 17, 2008
Posts: 89
Thanks Vijay
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11229
    
  16

since this is a JSP question, i'm going to move this over there, even though it appears you have your answer.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Duplicate of:
http://www.coderanch.com/t/293266/JSP/java/Relative-path-JSP-Servlets

Aditi AK,
Please don't ask the same question in multiple forums.
It wastes everyone's time.
Also, please check your private messages for an important administrative matter.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by vijay shanker:
When you're creating links to documents and images on the Web, you need to think about how you're going to link to them. There are two standard ways to create links:
* absolute paths
* relative paths

Absolute paths are called that because they refer to the very specific location, including the domain name. The absolute path to a Web element is also often referred to as the URL. For example, the absolute path to this Web page is: http:/abc.com/home/room/bed.htm


Relative paths change depending upon what page the links are located on. There are several rules to creating a link using the relative path:
* links in the same directory as the page have no path information listed
filename
* sub-directories are listed without any preceding slashes
weekly/filename
* links up one directory are listed as
../filename

How to determine the relative path:

1. Determine the location of the page you are editing.
This article is located in the/library/weekly folder on my site.
2. Determine the location of the page or image you want to link to.
The Beginner's Resource Center is located here: /library/beginning/
3. Compare the locations and to decide how to point to it
From this article, I would need to step up one directory (to/library) and then go back down to the beginning directory
4. Write the link using the rules listed above:
<a href="../beginning/bl_begin.htm"> ...</a>





One last note before closing this (see link to duplicate thread above).
Vijay's explanation of relative and absolute URLs in HTTP settings is good but it leaves out an important aspect of server side Java applications called the contextPath. With servlet and JSP apps, it is better to use the approach in our JSP faq when building URLs.
[ March 17, 2008: Message edited by: Ben Souther ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to specify Servlet path in JSP?