• Post Reply 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

action atttribute and difference between style of giving path of a servlet

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ???
 
Ranch Hand
Posts: 247
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..

 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
abhay jain
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ram Narayan.M,

for your opnion


Thanks a lot Bear Bibeault,

for making it more clear and easier
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic