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 …
How To Display Your System Font Families in Java
This tutorial highlights the API for displaying the list of font families available in your system using Java. You can get the font families using getAvailableFontFamilyNames() method of the local GraphicsEnvironment. The GraphicsEnvironment class describes the collection of GraphicsDevice objects and Font objects available to a Java(tm) application on a particular platform. Lets look at the example: FontListExample.java Output…
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 …
How To Display Environment Variables In Java
If you call getenv() method in the class System, it will return the map containing all the environment variables configured in your system. If you just iterate the map, it will display all the details. This example shows the simple program to print the environment variables. I have executed this example in the Ubuntu Linux OS, …
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 …