Difference

Recent Tutorial

URI 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? W3C and IETF There are two separate bodies W3C and IETF. The World Wide Web Consortium (W3C) […]
Published to Servlet Tutorial on 07/10/2009.

Difference 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, protocol-independent servlet. GenericServlet gives a blueprint and makes writing servlet easier. GenericServlet provides simple versions of the lifecycle methods init and destroy and of the methods in the ServletConfig interface. GenericServlet implements the log method, declared in the ServletContext […]
Published to Servlet Tutorial on 14/05/2008.

Difference 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 servlet using the web.xml deployment descriptor. For understanding, this is similar to a constructor in a java class. Example code: <servlet> <servlet-name>ServletConfigTest</servlet-name> <servlet-class>com.javapapers.ServletConfigTest</servlet-class> <init-param> <param-name>topic</param-name> <param-value>Difference between ServletConfig […]
Published to Servlet Tutorial on 06/05/2008.

Difference between ServletRequest.getRequestDispatcher and ServletContext.getRequestDispatcher

request.getRequestDispatcher(“url”) means the dispatch is relative to the current HTTP request. Example code: RequestDispatcher reqDispObj = request.getRequestDispatcher("/home.jsp"); getServletContext().getRequestDispatcher(“url”) means the dispatch is relative to the root of the ServletContext. Example code: RequestDispatcher reqDispObj = getServletContext().getRequestDispatcher("/ContextRoot/home.jsp");
Published to Servlet Tutorial on 06/05/2008.