Two Laptop Bag
The moose likes Servlets and the fly likes Servlet basics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet basics" Watch "Servlet basics" New topic

Servlet basics

maruti gangumolu

Joined: Aug 06, 2005
Posts: 1
1.hi firends!
i am new servlets. i had a doubt regarding doPost method in servlets,first if i use doPost method which objec(HttpServletRequest,HttpServletResponse) i must use to store information in database.what is the neccessity of calling doGet method from doPost.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
doGet and doPost work the same; the difference is in when they're called. doPost is called with the results of an HTTP POST, doGet is called with the results of an HTTP GET. You decide in the method parameter of your <form> tag which one of these it is. Generally, one of these does not call the other one (unless the difference between GET and POST does not matter to you, in which case you implement one of the two, and call that from the other one).

HttpServletRequest is used to access the parameters and information of the incoming request; HttpServletResponse is used to generate the page that is sent back. You would use neither of these to access a database - you have to code that yourself, just like you would in a desktop application.
I agree. Here's the link:
subject: Servlet basics
jQuery in Action, 3rd edition