| Author |
action atttribute and difference between style of giving path of a servlet
|
abhay jain
Ranch Hand
Joined: Jun 03, 2011
Posts: 130
|
|
style 01
<form method ="get"action="http://localhost:8080/rootam/Myname">
style 02
<form method ="get"action="Myname">
i want to know what "techinal term" a progrmmer should use for the first style of giving path , when we should use it ???
|
 |
Ram Narayan.M
Ranch Hand
Joined: Jul 11, 2010
Posts: 244
|
|
style 1 refers to the full path of the resource...
style 2 refers to the relative path of the resource..
In style2, action URL is resolved on the basis of current Request URL of the Page in the browser.
For instance,
http://localhost:8080/root/html/form.html contains "<form method ="get"action="Myname">"
action="Myname" The URL in this is resolved as "http://localhost:8080/root/html/Myname" by the browser which leads to Resource not found by the server...
To refer to Servlet, Style1 (Full path of servlet) is advisable..
|
SCJP 6 [SCJP - Old is Gold]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
Ram Narayan.M wrote:style 1 refers to the full path of the resource...
style 2 refers to the relative path of the resource..
Not completely correct. The first is the absolute URL, the second is the page-relative URL.
The former is used to address resources in other domains, the latter should never be used.
Rather, resources in the same web app, or from the same domain, should be addressed using server-relative addressing which begins with the context path of the web app.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
abhay jain
Ranch Hand
Joined: Jun 03, 2011
Posts: 130
|
|
Thanks Ram Narayan.M,
for your opnion
Thanks a lot Bear Bibeault,
for making it more clear and easier
|
 |
 |
|
|
subject: action atttribute and difference between style of giving path of a servlet
|
|
|