Quantcast
Channel: S. Nageswara Rao, Corporate Trainer – Way2Java
Browsing all 505 articles
Browse latest View live

sendRedirect Method Example in Servlet

We have seen earlier, the usage of include(), forward and their 15 differences. Now let us see how to use sendRedirect() method. The sendRedirect(String URL) is defined in...

View Article


Difference between forward and sendRedirect Methods

We have seen earlier include() and forward() methods of RequestDispatacher interface with example programs and figurative explanation. 15 differences were shown between include() and forward()....

View Article


Difference between RequestDispatcher from ServletRequest and ServletContext

We have seen two programs with include() and forward() methods of RequestDispatcher. In both the programs, getRequestDispatcher(String path) of ServletRequest is used to obtain an object of...

View Article

Stateless and Connectionless HTTP Protocol

What is HTTP (HyperText Transfer Protocol) Protocol? A protocol sets standards for communication between systems, client to server or among servers. HTTP is specially meant to communicate between...

View Article

What is Session, Session Tracking, Session Management, JSESSIONID?

For easy understanding, the notes is given in Question/Answer format. 1. What is a Session in Servlets? The interactive time between client and server on a single connection is known as a session. Or...

View Article


request.getScheme() Method Example in Servlets

This method is defined in ServletRequest interface from javax.servlet package inherited by HttpServletRequest. With this method, the servlet programmer can know what protocol (like HTTP) is used by the...

View Article

HTTP Session, HttpSession Methods in Java

Before reading this, it is advised to read the nature of HTTP protocol and what are session, session tracking and JSESSIONID. To maintain session in Servlets, the Java API comes with...

View Article

HttpSession Example Hit Count

After learning Session, Session tracking, Session ID and HttpSession and its methods, let us write a program to maintain session tracking using HttpSession interface. The aim of this code is, in a...

View Article


Servlet Cookies Simple Shopping Cart Example

Note: You can see the JESSIONID (Session ID) in the output screens at the end. Note: For better understanding, the subject is discussed in Question/Answer format. Note: Before going into this example,...

View Article


Java Servlet Cookie API Methods

Before going into the API, first let us know what for Cookie is? For better understanding the subject is discussed in Question/Answer format. 1. What is Cookie? For us, Cookie is a class from...

View Article

Servlet Life Cycle Tutorial with Methods

1. What is Servlet life cycle? Definition: Different states in which a Servlet exists between its object creation and object garbage collection is known as life cycle of Servlet. 2. Who is responsible...

View Article

Servlet Life Cycle Example with Database Connectivity JDBC

After learning what Servlet life cycle is and the methods involved, let us go for an example involving the life cycle methods. I take the opportunity to connect to database and read table records using...

View Article

request.getRemoteAddr() Method Example in Servlets

This method is defined in ServletRequest interface from javax.servlet package inherited by HttpServletRequest. With this method, the servlet programmer can know the IP address of the client from which...

View Article


Servlet getHeaderNames() and getHeader() Simple Example

Header Information When a client clicks a hyper link or a submit button, we know that the data entered by the user in the Form fields is sent to server and is the default behaviour of submit button....

View Article

Servlet WAR File in Tomcat with Creation, Deployment, Execution

We have seen earlier what a JAR file is, its options, creation and advantages in JAR (Java ARchive) Files. Now let us study what a WAR file is and its creation etc. WAR stands for Web ARchive. A WAR...

View Article


Sending Image to Client from Servlet Example

So far all the earlier examples, we used to send text or HTML messages (text/html) to client. Now-a-days, images are also playing important role in client/server communication. For example, you go to...

View Article

Servlet WAR File in Weblogic Creation and Deployment

With the release of the Java Servlet Specification 2.2, the concept of a Web application was introduced. According to this specification, a "Web Application is a collection of servlets, html pages,...

View Article


Servlet Read text file and Return contents to Client Example

Sometimes, the client may ask the Servlet to send the file contents of a file existing on the server. It is not file download. Here, the Servlet reads manually line-by-line and send each line...

View Article

Servlet Read HTML File Contents Example

Earlier we did a program where client requested for a text file; but the case now is with HTML file. If the user sends a request for HTML file, when it comes to the browser, it is interpreted and...

View Article

Status bar Applet showStatus() method Example

Displaying messages is of two ways in Applet. One way is displaying anywhere in the applet window and the other way is displaying in the status bar. The bottom of the applet window is known as status...

View Article
Browsing all 505 articles
Browse latest View live