Get Query String from Servlet Request

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…]

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 Servlet Application article for the basic understanding.  [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.

  1. Create a directory under Tomcat for our application.
  2. Coding our servlet. We will be using javax.servlet package and the javax.servlet.http package in our source code.
  3. Create a deployment descriptor.
  4. Compile our source code.
  5. Run Tomcat and call the servlet from the web browser.

[Read more…]