This tutorial post highlights the important difference between JSP and Servlet technologies. Servlet and JSP are the two key Java server side technologies that are building blocks for any of the Java web frameworks. It is important to know the difference between these two technologies. This is one of the fundamental concept that confuses the many …
Java EE
sendRedirect in Servlet
Java EE Tutorials Servlets Tutorials Servlets Interview Questions In this article we shall see how to redirect your current page to some other page. The easiest way to achieve this is by using the sendRedirect() method of class javax.servlet.http.HttpServletResponse. sendRedirect() method redirects your current page to another servlet or jsp page. This method is used …
Request Dispatcher In Servlet
Java EE Tutorials Servlets Tutorials Servlets Interview Questions Request Dispatcher While developing web applications we need to distribute the request processing and response generation to multiple servlet objects. So we need to dispatch requests from one component to another component. This can be done by using RequestDispatcher interface. RequestDispatcher interface is implemented by servlet container …
Servlet Context
Java EE Tutorials Servlets Tutorials Servlets Interview Questions Servlet Context is used to communicate with the servlet container to get the details of web application. It is created at the time of deploying the project. There is only one Servlet Context for entire web application. Servlet Context parameter uses <context-param> tag in web.xml file. Methods of …
Web.xml
Java EE Tutorials Servlets Tutorials Servlets Interview Questions To understand web.xml, first let us uderstand what is xml? xml stands Extensible Markup Language. xml is markup language much like html. Xml defines set of rules for encoding document in a format that readable by both as human and machine. Xml was designed to carry and …
Servlet Example
Java EE Tutorials Servlets Tutorials Servlets Interview Questions Let us create a simple servlet example using Eclipse IDE. To create servlet application we need to use following steps: Environment used: JDK Eclipse IDE Apache Tomcat Server Java-api Open the Eclipse IDE and Go to File Menu ->New->Select Dynamic Web Project. Enter Project Name click on …
Generic Servlet and Http Servlet
Java EE Tutorials Servlets Tutorials Servlets Interview Questions Generic Servlet GenericServlet is an abstract class defined in the Servlet API. For implementing class we need to implement all the methods in javax.servlet.Servlet Interface. Most of the Servlet objects do not need initializing and destroying operations but still we need to implement all the methods in …
Servlet API
Java EE Tutorials Servlets Tutorials Servlets Interview Questions The Servlet API is supported by all Servlet containers, such as Tomcat and Weblogic, etc. The Application Programming Interface (API) contains interface and classes to write a servlet program. The servlet API contains two packages as listed below: javax.servlet javax.servlet.http Package javax.servlet javax.servlet contains a number of …