Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to specify Servlet path in JSP?

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Thanks Vijay
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Duplicate of:
https://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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
    Bookmark Topic Watch Topic
  • New Topic