MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology

Java Servlet Programing Laungage

Java Servlet Projects

Servlet Project 3

Java Servlet :HttpServlet class in Servlet and its implementation.
Previous Home Next

javax.servlet.http.HttpServlet

This class extends GenericServlet and defines method for each Http request.Commonly used methods of this class are doGet() and doPost() which are used to process http get and post request respectively.

Syntax
  1. public void doGet(HttpservletRequest request,HttpServletResponse response)	
    					throws ServletException,IOException ;
    	

    Parameters

    • response HttpServletResponse that encapsulates the response from the servlet.
    • request HttpServletRequest that encapsulates the request to the servlet.
    • Throws: IOException if detected when handling the request.
    • Throws: ServletException if the request could not be handled.
  2. public void doPost(HttpServletRequest request,HttpServletResponse response) 
    					throws ServletException,IOException;
    	

    Parameters

    • response HttpServletResponse that encapsulates the response from the servlet.
    • request HttpServletRequest that encapsulates the request to the servlet.
    • Throws: IOException if detected when handling the request.
    • Throws: ServletException if the request could not be handled.

 

Implementation of Httpservlet:-
public class HttpServlet extends GenericServlet
{
public void service(ServiceRequest request,ServiceResponse response) 
			throws ServletException,IOException
{
HttpServletRequest req=(HttpServletRequest)request ;
HttpServletResponse res=(HttpServletResponse)response ;
service(req,res);
}
protected void service(HttpServletRequest request,HttpServletResponse response) 
	throws ServletException,IOException
{
request type is checked and doGet() and doPost() etc methods are invoked.
}
public void doGet(HttpServletRequest request,HttpServletResponse response) 
			throws ServletException,IOException{}
public void doPost(HttpServletRequest request,HttpServletResponse response) 
			throws ServletException,IOException{}
}
Previous Home Next