Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Java Servlets
Expertise: Beginner
Feb 18, 2000



Application Security Testing: An Integral Part of DevOps

GET and POST Requests

How does a servlet handle GET and POST requests?

The HttpServlet abstract class, defined in the javax.servlet.http package, contains several methods that simplify interacting with HTTP requests. Two of the methods take care of handling GET and POST requests. When you write a servlet, you should subclass HttpServlet and implement the doGet() method to handle GET requests. Similarly, to handle POST requests, you would implement the doPost() method.

Both methods take an HttpServletRequest instance and an HttpServletResponse instance as arguments. The HttpServletRequest instance contains all the information pertaining to the request, including any request parameters. The HttpServletResponse is used to generate a response to the request.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date