The getQueryString() method is defined in the HttpServletRequest interface, which is used to retrieve the query string of the HTTP request. A query string is the string on the URL to the right of the path to the servlet. Using this a programmer can know the data which is sent from the client(when a form is submitted) … [Read more...]
ServletRequest Interface – Servlets
The ServletRequest Interface defines an object which is used to encapsulate information about the user's request, including parameter name/value pairs, attributes, and an input stream. … [Read more...]
HttpServlet class
The HttpServlet class extends the GenericServlet class and implements Serializable interface. It provides all the Http protocol supported methods such as doGet(), doPost(), doHead(), doPut(), doDelete(), doOptions(), doTrace(). … [Read more...]
GenericServlet class
GenericServlet is a abstract class which is defined in the Servlet API. GenericServlet class implements Servlet, ServletConfig and Serializable interfaces, it provides implementation for all the methods of the Servlet Interface except the service() method. … [Read more...]
Servlet Interface
Servlet Interface provides the common methods which needs to be implemented by all the servlets. All the servlets must implement this interface directly or indirectly. To have the implementation of the Servlet Interface you can extend GenericServlet Class(javax.servlet.GenericServlet) or HttpServlet Class (javax.servlet.http.HttpServlet). Read through Running Your First … [Read more...]
Running Your First Servlet Application
Once we have installed and configured Tomcat, we need to follow the below five steps to run our First Hello World Application. Create a directory under Tomcat for our application. Coding our servlet. We will be using javax.servlet package and the javax.servlet.http package in our source code. Create a deployment descriptor. Compile our source code. Run Tomcat … [Read more...]
Life Cycle of a Servlet
The Servlet Container is responsible for maintaining the life cycle of a Servlet. The life cycle has the below following phases. Load Servlet Class Servlet instance is created init() method is invoked service() method is invoked destroy() method is invoked … [Read more...]
Difference between ServletConfig and ServletContext
ServletConfig and ServletContext are the two import interfaces in ServletAPI, Lets see whats the difference between them and how to use. ServletConfig ServletConfig is available in the javax.servlet.* package. ServletConfig object will be created during the initialization(init()) of the servlet. … [Read more...]