-3
public void doGet(HttpServletRequest request,HttpServletResponse response){
}

and

public void doPost(HttpServletRequest request,HttpServletResponse response){
}
Kyll
  • 7,036
  • 7
  • 41
  • 64

1 Answers1

0

In HTTP protocal GET and POST are type of request headers. So whenever a GET type of request is recieved by server, doGet() method is invoked at the backend. Same goes for POST, doPost() is invoked.

Example: This will invoke doGet when html form is submitted.

<form method="GET" action="servletname">

This will invoke doPost()

<form method="POST" action="servletname">

There are more request type headers like put, delete that are used for implementing REST api.

Rishabh Kumar
  • 527
  • 4
  • 14