• 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

Servlet basics

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic