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 …
Servlets Tutorials
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 …
Introduction to Servlet
Java EE Tutorials Servlets Tutorials Servlets Interview Questions What is Servlet ? Servlets are an important component of a J2EE application. Servlets along with JavaServer Pages (JSP) and EJB modules can be termed as server-side J2EE component types. Servlet is a Java Programming Language. Servlets are used to create web applications. Servlets are used to …