Java Made Clear: Auto Page Refresh with Servlets setHeader()
Sometimes, user requires latest information on Cricket score or latest Share prices etc. where he is required to refresh the page, say by typing F5 key. To make user’s job easier, Servlet comes with...
View ArticleJava Made Clear: response.setContentType() Method Example
We know when a Servlet is loaded, the Servlet container creates an object of Servlet, calls service() method, creates an object of HttpServletRequest and also an object of HttpServletResponse and...
View ArticleJava Made Clear: What is MIME type in Servlets?
1. What is MIME? MIME is an abbreviation for "Multipurpose Internet Mail Extensions". At the start, email was intended to transport for textual message only and later added attachments etc. These...
View ArticleJava Made Clear: System.in, System.out and System.err
Every OS comes with three built in streams – in, out and err entirely managed by OS. We know from IO Streams that a stream is a flow of data between two terminals (may be two files or two sockets...
View ArticleJava Made Clear: What is HttpServletRequest and HttpServletResponse?
Both are interfaces from javax.servlet.http package. They are derived from ServletRequest and ServletResponse interfaces. Both objects are created and implicitly passed to the service() method of...
View ArticleJava Made Clear: 15 Advantages of Servlets over CGI and ASP
First let us know the earlier Web technologies, their drawbacks and how they are overcome in Servlets. Earlier to Servlets, the other Web technologies existed were CGI/PERL and ASP. I. CGI/PERL (Common...
View ArticleJava Made Clear: Can we write constructor in Servlet Example
Yes, you can have as per rule. It is executed even before init(). Then why generally we avoid constructor in Servlets. First let us write one simple example and see it is true or not; then we will go...
View ArticleJava Made Clear: Difference MouseListener MouseMotionListener
The java.awt.event package comes with two interfaces to handle the events of mouse – MouseListener and MouseMotionListener. They are differentiated by the state of the mouse when an event generated. 1....
View ArticleJava Made Clear: Difference WindowListener and WindowAdapter
After learning the difference between a listener and adapter, let us dig more specifically with WindowListener and WindowAdapter. First let us discuss interms of API. Following are the signatures as...
View ArticleJava Made Clear: Difference MouseMotionListener and MouseMotionAdapter
After learning the difference between a listener and adapter, let us dig more specifically with MouseMotionListener and MouseMotionAdapter. First let us discuss interms of API. Following are the...
View ArticleJava Made Clear: Difference MouseListener and MouseAdapter
After learning the difference between a listener and adapter, let us throw more focus on MouseListener and MouseAdapter. First let us discuss interms of API. Following are the signatures as defined in...
View ArticleJava Clear Concepts: Java Main Features and Characteristics
Java was released to market in 1995 with its first version JDK 1.0. From day one, it is treated as an important language used to develop many applications that are increasing everyday; the latest being...
View ArticleJava Parsing: Convert String to int in Java – parseInt()
1. What is parsing? Casting (either implicit or explicit) is the process of converting one data type to another. But in all programming languages, sometimes a string value is required to convert into...
View ArticleConvert String to double in Java – parseDouble()
1. What is casting? Casting is the process of converting one data type to another in a programmng language. Casting may be implict or explict. 2. Why casting is required in a programming language? It...
View ArticleServlets Made Clear: ServletContext.getResourceAsStream
Using the method getResourceAsStream(), a Servlet can use any file on the system (or Web application in WEB-INF folder) and load it. To load, the Sevlet container does not need a traditional class...
View ArticleJava Simple: Mouse Multiple Clicks Example getClickCount()
getClickCount() of MouseEvent class returns the number of clicks done on mouse. Following is the method signature as defined in class java.awt.event.MouseEvent public int getClickCount(): Returns the...
View ArticleJava Anonymous Inner classes with Listeners Adapters Example
Anonymous inner classes were introduced, at the first, to make event handling simpler and easier. With inner classes, forget the laborious days of implementing listeners and extending adapters classes....
View ArticleJava Made Clear: What is ServletConfig interface?
The needs of server-side programming are well thought and architectured by Servlet Designers. If a specific Servlet should be started with some default properties well-suited for certain job, the...
View ArticleJava Made Clear: What is ServletContext interface?
ServletConfig interface is specific to a particular Servlet. It cannot read other Servlet <init-param> data because <init-param> is written within <servlet> tag. On the contrary,...
View ArticleDifference between ServletConfig and ServletContext
After knowing fully of ServletConfig and ServletContext with examples, explanation and screen outputs, it is time to compare them for still better understanding. Following table summarizes the...
View Article