Posts

Difference between Technology and Framework

Technology is built on top of language where as framework is built on top of technology. 

Session Tracking

 At the time of processing the later request, if we want to get the data of previous request, then we need to go for "session tracking." Every server side technology should support session tracking because the protocol used is http and it is 'stateless' in nature.

ServletConfig

 This object is used to store the configuration details of a particular servlet like logical name of the servlet, initialization parameters and so on... Using servlet config we will get to know the complete view of a particular servlet. Servlet Config will be instantiated during the initialization of the Servlet.  Loading => static block  instantiation  => public zero arguments constructors  initialization => public void init (ServletConfig config) throws SE Request Processing => public void doXXXX(HSR request, HSR response) throws SE, IOE De Instantiation =>  public void destroy() Servlet Config object is specific to a particular servlet. Servlet Config object will be destroyed just before the Servlet Deinstantiation. We can add only parameters data inside the config object. In web.xml <init-params> will be placed under servlet class level as it is specific to particular servlet and the data present in one servlet config object cannot ...

ServletContext (Interface)

 When we do deployment (manual), server will scan "webapps" folder and identifies the projects which is deployed.  All the identified projects will be kept in Meta-space of server. For every project which is deployed in 'Meta-space' automatically 'Servlet Context' object will be created.  Context object can be accessed in the entire project, meaning in all the servlets of the project. As this is the first object created after deployment. we can keep the database details like URL, username, password and we can retrieve when ever we required.   For all the servlets in the project what ever the data is required, that data will be placed in the Servlet Context object.  Servlet Context object will be destroyed when we undeployed the project. We can keep parameter data and attribute data inside the Servlet Context object. In web.xml, <context-params> will be placed under <web-app> because it will be accessible by all the servlets present in the projec...

Types of HttpRequest methods

 1. GET 2. POST 3. HEAD 4. PUT 5. DELETE 6. OPTIONS 7. TRACE GET, POST, HEAD are introduced in http protocol version 1.0v PUT, DELETE, OPTIONS, TRACE are introduced in http protocol version 1.0v GET and POST are used in web applications.

Generic Servlet Abstract class

 GenericServlet Abstract class contains below methods  public javax.servlet.GenericServlet();   public void destroy();   public java.lang.String getInitParameter(java.lang.String);   public java.util.Enumeration<java.lang.String> getInitParameterNames();   public javax.servlet.ServletConfig getServletConfig();   public javax.servlet.ServletContext getServletContext();   public java.lang.String getServletInfo();   public void init(javax.servlet.ServletConfig) throws javax.servlet.ServletException;   public void init() throws javax.servlet.ServletException;   public void log(java.lang.String);   public void log(java.lang.String, java.lang.Throwable);   public abstract void service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) throws javax.servlet.ServletException, java.io.IOException;   public java.lang.String getServletName();

HttpServlet Abstract class

 Generic servlet meant for any protocol interaction like http, smtp, ..  For a web application, the protocol used is http, so to work with specific protocol, sun micro system had come up with SRS called HttpServlet.