Question
Write a servlet program to display your name, address, date_of_birth and current date and time. The program should also calculate your age and display it.
Answer :
Word Count : 586
_________ ______ _____ _________ ________ _______ _________ ____ ______ ________.
______ ______ _____ ___ __________ _________ ________ ____ ___ _______.
________ _____ _________ _______ ________.
___ ________ ____ ____ _____ __________ ____ _____ _____ _________.
___ _________ _____ ______ ________ _____ ________ _________ ___ ___ ________.
___ _______ _______ ________ _______ _________ ____ _______ ___ __________ ______ ________.
_________ __________ ____ ____ _____ ___.
________ ____ _________ _______ ________ _____ _____ __________ ______ ___.
_______ _________ ________ ____ _____ _____ ____ _____ ____ _______ _________ ___.
_____ ______ ______ __________ __________ ________ __________ __________ _______ __________ ______ ____.
__________ _______ _____ _____ ____.
________ ____ ____ _________ _______ ____ _______ _________ ______ ___.
______ ______ ___ _______ _____.
_________ _________ _______ _____ __________ ______.
________ __________ _______ _________ _________ ___ _________ ________ _______ _________ ________ ____.
___ ______ ____ ________ ___ _________ _______ __________ _______ _____ __________.
_________ _____ ____ _______ ______ _________ ___ ___ _________ _______.
_____ ______ ______ ______ __________ _____ ______ _____ _________ __________ __________ _________.
______ ________ ___ ________ ________ __________ _________ ___ _________ ___ __________ _______.
_____ _____ _____ _________ _____ ____ ____.
_____ _________ ____ ______ _____.
________ __________ ___ _________ _________ _______ _____.
___ ____ __________ __________ __________ ______ ________ _____ ________ ______.
_____ _______ __________ ________ _________ _______ _____ _____.
_____ __________ _____ __________ _______.
__________ ____ __________ ___ _________ _________ ___ __________ _________ ________ _______.
____ ____ ____ ___ _______ ____ ______ _______ _____.
_________ ____ ________ ________ _______ ________ _____.
_______ _________ _________ _________ __________ ______.
______ ____ _______ ________ ____ ________ _____.
_____ _________ __________ _____ _______ _______ ______ ___ ___ ______ __________.
_________ __________ ____ ________ _______.
____ _____ ____ _______ ____ ___ _________ _______ __________ ________ ________ ____.
___ _____ __________ ___ ________.
____ ________ _______ _____ ________ ________.
_________ ____ ___ ______ _______.
_____ ________ _______ _________ _________ ____ __________ _______ ___ ___ ________.
_____ __________ ___ ____ ______ __________ _______ _______ ___ ______ ____.
______ ____ ___ _____ ____.
_____ _______ _______ ________ ____ ___ ___.
________ ___ ________ ________ _______ _______ ______.
______ __________ ____ ________ __________ ____ _________ __________ ________ ___ _______ _____.
_________ _________ _____ _____ _______ ________ ________ ________ _______ _________ ________ _________.
______ _____ _____ _________ __________ ______ ____ __________.
_________ __________ ________ ____ ______ ____ _____ _______.
________ ________ __________ __________ ___ _____ _____ ________ ____.
_________ ___ _________ __________ _____.
___ ______.
Skip in 10
To create a servlet program that displays personal information such as your name, address, date of birth, current date, time, and calculates your age, you need to have a basic understanding of Java Servlets. Here’s how to approach this:
-
Set up the environment:
- Install a servlet container like Apache Tomcat, and set up your Java development environment (e.g., Eclipse or IntelliJ IDEA).
- Create a new Dynamic Web Project and add the necessary servlet libraries (
javax.servlet).
-
Create the Servlet:
- A servlet is a Java class that extends
HttpServletand overrides thedoGetordoPostmethod to handle HTTP requests.
- A servlet is a Java class that extends
-
Code the Servlet:
- In this example, we will write the servlet to display your personal details (name, address, date of birth) and calculate your age based on the current date.
import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.text.*; import java.util.*; public class PersonalDetailsServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Set the content type for the response response.setContentType("text/html"); // Get the PrintWriter ______ ______ _____ ___ __________ _________ ________ ____ ___ _______.
________ _____ _________ _______ ________.
___ ________ ____ ____ _____ __________ ____ _____ _____ _________.
___ _________ _____ ______ ________ _____ ________ _________ ___ ___ ________.
___ _______ _______ ________ _______ _________ ____ _______ ___ __________ ______ ________.
_________ __________ ____ ____ _____ ___.
________ ____ _________ _______ ________ _____ _____ __________ ______ ___.
_______ _________ ________ ____ _____ _____ ____ _____ ____ _______ _________ ___.
_____ ______ ______ __________ __________ ________ __________ __________ _______ __________ ______ ____.
__________ _______ _____ _____ ____.
________ ____ ____ _________ _______ ____ _______ _________ ______ ___.
______ ______ ___ _______ _____.
_________ _________ _______ _____ __________ ______.
________ __________ _______ _________ _________ ___ _________ ________ _______ _________ ________ ____.
___ ______ ____ ________ ___ _________ _______ __________ _______ _____ __________.
_________ _____ ____ _______ ______ _________ ___ ___ _________ _______.
_____ ______ ______ ______ __________ _____ ______ _____ _________ __________ __________ _________.
______ ________ ___ ________ ________ __________ _________ ___ _________ ___ __________ _______.
_____ _____ _____ _________ _____ ____ ____.
_____ _________ ____ ______ _____.
________ __________ ___ _________ _________ _______ _____.
___ ____ __________ __________ __________ ______ ________ _____ ________ ______.
_____ _______ __________ ________ _________ _______ _____ _____.
_____ __________ _____ __________ _______.
__________ ____ __________ ___ _________ _________ ___ __________ _________ ________ _______.
____ ____ ____ ___ _______ ____ ______ _______ _____.
_________ ____ ________ ________ _______ ________ _____.
_______ _________ _________ _________ __________ ______.
______ ____ _______ ________ ____ ________ _____.
_____ _________ __________ _____ _______ _______ ______ ___ ___ ______ __________.
_________ __________ ____ ________ _______.
____ _____ ____ _______ ____ ___ _________ _______ __________ ________ ________ ____.
___ _____ __________ ___ ________.
____ ________ _______ _____ ________ ________.
_________ ____ ___ ______ _______.
_____ ________ _______ _________ _________ ____ __________ _______ ___ ___ ________.
_____ __________ ___ ____ ______ __________ _______ _______ ___ ______ ____.
______ ____ ___ _____ ____.
_____ _______ _______ ________ ____ ___ ___.
________ ___ ________ ________ _______ _______ ______.
______ __________ ____ ________ __________ ____ _________ __________ ________ ___ _______ _____.
_________ _________ _____ _____ _______ ________ ________ ________ _______ _________ ________ _________.
______ _____ _____ _________ __________ ______ ____ __________.
_________ __________ ________ ____ ______ ____ _____ _______.
________ ________ __________ __________ ___ _____ _____ ________ ____.
_________ ___ _________ __________ _____.
___ ______.
IGNOU ACADEMY
Your IGNOU journey, made easier.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
Continue Reading — It's Free
Sign in with Google to unlock more of this answer.
✓ Free access
✓ Unlock up to 60% of the answer
✓ No payment required
✓ Unlock up to 60% of the answer
✓ No payment required
Quick Google sign-in. No separate registration form.