• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Method - POST

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hanumant dekhmukh book says :: (Pg 36)

Q: Which method of TestServlet will be called when a user clicks on following URL?
<a href="/servlet/TestServlet" method="POST"> Test URL </a>

As method is "POST", I thought the answer would be doPost but answer is following in book:

- The method "POST" attribute-value pair does not make sense in the <a href> tag. Clicking on hyperlink always sends a GET request and thus the doGet() method will be called.

Can anyone explain - if method is specified...is it possible that doGet is still invoked.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The method "POST" attribute-value pair does not make sense in the <a href> tag.


This says it all. If you check the HTML specification, you'll see that there's no such "method" attribute for the "a" tag. (It is a valid attribute with a "form" tag)
 
Ashu Jain
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it thanks.

I have not read HTML spec. Is it important for me to read HTML spec to pass SCWCD with good marks
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not that important, but for somebody who wants to become a web component developer, I think it is You should know at least the basics, like what forms and links are.
 
Who knew that furniture could be so violent? Put this tiny ad out there to see what happens:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!