HTTP Servlet
In today's post I will share about the advancing with servlets in the earlier post we have studied about the Generic servlet and http servlet what else with http servlet can be done will see today in this post, Http servlet is the sub class of Generic servlet and we have seen that in generic servlet has declared service method as abstract and Http is derived from Generic servlet so definitely service method is to be defined in it. Besides service method two more methods have been defined in Http servlet and they are doget and dopost they are defined as
public void doget(HttpServletRequest req,Http ServletResponse res)
{
}
AND
public void dopost(HttpServletRequest req,Http ServletResponse res)
{
}
These two methods are very much useful these two methods are used to catch our request from our normal Html forms generally when we click on submit button we are requesting either by post or get that means either we are sending information or requesting through get or post method so For that if we are programming through servlets we have to define the either dopost or doget method so it can handle request which is requested by a normal form.
In dopost or doget you can write anything generally in register form we have to input data in the database so can establish connection and can fire insert query for all records you want to insert in database.
public void doget(HttpServletRequest req,Http ServletResponse res)
{
}
AND
public void dopost(HttpServletRequest req,Http ServletResponse res)
{
}
These two methods are very much useful these two methods are used to catch our request from our normal Html forms generally when we click on submit button we are requesting either by post or get that means either we are sending information or requesting through get or post method so For that if we are programming through servlets we have to define the either dopost or doget method so it can handle request which is requested by a normal form.
In dopost or doget you can write anything generally in register form we have to input data in the database so can establish connection and can fire insert query for all records you want to insert in database.
Comments
Post a Comment