Bookmark Topic Watch Topic
  • New Topic

How to specify Servlet path in JSP?

 
K Aditi
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
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?
 
vijay shanker
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Thanks Vijay
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12015
24
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
since this is a JSP question, i'm going to move this over there, even though it appears you have your answer.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
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 ]
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic