Tag: Servlet

Add Custom Header to HTTP Request In this post, we will show you a Java servlet simple example program about, how to add custom header to HTTP header in filter. This program has been tested and shared in the same post. Request Wrapper Class package com.dineshkrish; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.List; import […]
Auto Refresh in Servlet In this tutorial, We will show you example program about, How to do an auto refresh in servlet. The program has been tested and shared in the post. Project Structure Servlet Class (AutoRefreshServlet.java) package com.dineshkrish.servlet; import java.io.IOException; import java.io.PrintWriter; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; […]
Returning XML Response in Servlet In this sample application, We will show you how to return XML response in Servlet application. This example application has been tested and shared in the same post. Project Structure Servlet Class (ProductService.java) package com.dineshkrish.service; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.dineshkrish.pojo.Product; import […]
Call RMI Service using Servlet Application In this example, I will show you how to call RMI service using servlet application. This example was tested with Apache Tomcat environment and output has been shared in the same post. 1. Developing RMI Service In this part, we are going to develop the RMI Service, Which can […]
Return JSON Response in Servlet In this example, we will show simple example about how to return Json response in servlet. The example program has been tested with apache tomcat environment and output are shared in the post. Project Structure Servlet Class (EmployeeService.java) package com.dineshkrish.service; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; […]
Download PDF File in Servlet In this example, we will show you how to download PDF file in servlet. The example application was tested with Apache Tomcat Web Server and output has been shared in the same post. Project Structure Servlet Class (Downloader.java) package com.dineshkrish.servlet; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; […]
Read Cookies in Servlet In this example, we will show you simple program about how to read cookies in servlet. The example program has been tested with Google Chrome browser and output shared in the below post. Note: Before going to proceed with this example make sure that, you have already created cookies using servlet. […]
Create Cookies in Servlet In this simple example, we will show you how to create cookies in servlet. This particular example has been tested with Google Chrome browser environment. The example source code has been explained step by step in the below post. Servlet Code (MyCookieServlet.java) package com.dineshkrish.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import […]
Simple Login Application using Servlet This example will show step by step procedure to develop Simple Login Application using Servlet technology. In this tutorial, We will show you how to develop simple login application using Servlet, JSP, and JDBC. The example has been tested with MySQL and Apache Tomcat Server environment and output has been […]
Display Multiple Records from Database in JSP This example about, How to Display Multiple Records from Database in JSP, Servlet and JDBC Project Structure Table Information Table Query CREATE TABLE student_details(firstName varchar(30), lastName varchar(30), age int, emailId varchar(50), contactNumber varchar(12), address varchar(100)); INSERT INTO student_details VALUES(‘Dinesh’, ‘Krishnan’, 25, ‘dinesh@idineshkrishnan.com’, ‘9941937705’, ‘India’); INSERT INTO student_details VALUES(‘Johanthan’, […]
Simple Registration Application using Servlet In this tutorial, I have written code about, Simple Registration Application using Servlet, JSP, and JDBC. The application was tested in MySQL Database and same has been shared in the article. Project Structure Table Query CREATE TABLE student_details(firstName varchar(30), secondName varchar(30), age int, emailId varchar(50), dob date, contactNumber varchar(12), qualification […]