Hi, I have a doubt in Servlets.In a Servlet class we need to override doGet()/doPost() methods.The invoking of corresponding methods will depend on the way the form submitted.If the form is submitted with GET method then doGet() is invoked.If POST is used doPost() is invoked().My question is how the servlet engine recognises that a form is submitted with GET/POST method.I will be highly grateful for the same. Regards Soma.
The Service method is invoked when the client acceses the servlet. It dispatches the request to the corresponding doGet/doPost method. This servicemethod checks the HTTP Request type get/Post and calls the corresponding doget/doPost method The method is specified on the form when it's submitted. If no method is specified at all, the default is to use doGet.
Bosun (SCJP, SCWCD).
So much trouble in the world -- Bob Marley
HTTP, like most of the original Internet protocols is based on transmissions of text messages. This was partly because the original nodes of the Internet had different internal binary representations, and quite a few of them had different character codesets (ASCII or EBCDIC). It's much easier to translate codesets than binary fields, especially when you're bouncing a message through a dozen intermediate computers or more. There's another fringe benefit - it's easier to debug the protocol if you can directly print eveything going up and down the wire - or even drive it manually via a telnet to port 80. You can write Internet apps all day long, but you'll never truly be an Internet Guru until you know what the format and sequence of those messages are. They're documented in a set of RFC (Request For Comment) documents, and the one for HTTP v1.1 is RFC2068: http://www.w3.org/Protocols/rfc2068/rfc2068 The short answer tou your question, though, is that if you have a hyperlink or a form whose action is "GET", a message in the following form is sent: GET http://www.myserver.com/mypage.cgi?arg1=foo&arg2=bar If a form has action POST, it will look more like: POST http://myserver.com/mypage.cgi arg1 foo arg2 bar There may be some inaccuracies here, and I haven't bothered to show the headers, but that's the core of it. The RFC is the authority. [ January 11, 2002: Message edited by: Tim Holloway ]
When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.