Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Method - POST

 
Ashu Jain
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.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 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 Ubuntu VI Editor
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic