How to avoid IllegalStateException in java servlet?
The root cause of IllegalStateException exception is a java servlet is attempting to write to the output stream (response) after the response has been committed. It is always better to ensure that no...
View ArticleWhat happens if you call destroy() from init() in java servlet?
destroy() gets executed and the initialization process continues. It is a trick question in servlets interview. In java servlet, destroy() is not supposed to be called by the programmer. But, if it is...
View ArticleSession Tracking Methods
Following answer is applicable irrespective of the language and platform used. Before we enter into session tracking, following things should be understood. What is a session? A session is a...
View ArticleServlet JSP Communication
getServletConfig().getServletContext().getRequestDispatcher(“jspfilepathtoforward”).forward(request, response); The above line is essence of the answer for “How does a servlet communicate with a JSP...
View ArticleSession Life Cycle
When I say life cycle, I can hear you murmur “Oh no not again, how many life cycles I have to deal with”! In real world everything has life cycle, then why not in programming, after all, software is...
View ArticleURI And URL Difference
Before going into URL and URI, you need to know some background. Do you ever thought about, who decides what is URL? and what is URI? or who is the authority for URL, URI and such naming conventions?...
View ArticleDifference between ServletConfig and ServletContext
Signature: public interface ServletConfig ServletConfig is implemented by the servlet container to initialize a single servlet using init(). That is, you can pass initialization parameters to the...
View ArticleWhat is preinitialization of a java servlet?
In the java servlet life cycle, the first phase is called ‘Creation and intialization’. The java servlet container first creates the servlet instance and then executes the init() method. This...
View ArticleDifference between HttpServlet and GenericServlet
javax.servlet.GenericServlet Signature: public abstract class GenericServlet extends java.lang.Object implements Servlet, ServletConfig, java.io.Serializable GenericServlet defines a generic,...
View ArticleWhat is servlet mapping?
Servlet mapping specifies the web container of which java servlet should be invoked for a url given by client. It maps url patterns to servlets. When there is a request from a client, servlet container...
View ArticleWhat is Servlet
The Servlet is a type of Java class used in Java web applications which enhances the capabilities of a server. These Java servlets runs on a web application server container. These servlets are used to...
View ArticleServlet Jargons
Before going through the complete Servlet tutorial, it is better to understand tech jargons related to Servlets. Following are some of the tech jargons related to Java Servlet technology, HTTP HTTP...
View ArticleServlet Getting Started
This part of the servlet tutorial is to setup the development environment required to execute Servlets. Install and Setup Java To run the Java Servlets we need a Servlet container like Apache Tomcat....
View ArticleServlet Hello World
This tutorial is the standard Hello World program using Java Servlet. Using an IDE is the best choice to do development. It will help to increase the productivity. If you are in the early days of...
View ArticleServlet Read Form Data
This Servlet tutorial is to take you to the next step in learning servlets. As stated earlier in start of the servlet tutorial series, servlets are primarily meant for web applications. In this let us...
View Article