Department of Computer Engineering
Academic Year: 2025-26
Year: SE Semester: III Subject: JAVALab
Name of Student: Priyangee Kha
Roll No.: 31
Moodle Id: 24102108
Date of Performance: 1 9 - 9 - 2 5
Date of Submission: 19-9-25
Name of Instructor: Prof. Kadambari
EXPERIMENT NO. 6
Aim: Demonstrate the use of implicit objects in JSP.
Program:
<html>
<head>
<title> First Program </title>
</head>
<body>
<h1> Output of JSP file </h1>
<%
[Link]("Hello World");
%>
</body>
</html>
Output:
EXERCISE 6-1:
Aim: Write a JSP program to display current date and time.
Program:
<%@ page import="[Link]" %>
<!DOCTYPE html>
<html>
<head>
<title>Current Date and Time</title>
</head>
<body>
<h2>Current Date and Time</h2>
<p>
<%
Date now = new Date();
[Link]([Link]());
%>
</p>
</body>
</html>
Output:
EXERCISE 6-2:
Aim: Develop a web application that accepts user details such as name, birth date, email address, and
lucky number through an HTML form. The form should submit data to a JSP page using the POST
method, where the server retrieves the input values using the [Link]() method. The
application must also demonstrate simple data type handling by converting the lucky number into an
integer before processing. Finally, the JSP page should dynamically display the collected
information in a structured format on the browser.
Program:
<%@ page import="[Link].*, [Link].*"
%>
<html>
<head>
<title>Processed User Details</title>
</head>
<body>
<h1>User Details Submitted</h1>
<%
// Retrieving form values using
[Link]()
String name =
[Link]("username");
String birthdate =
[Link]("birthdate");
String email =
[Link]("email");
String luckyNumStr =
[Link]("luckyNumber");
// Convert lucky number from String to
int
int luckyNumber = 0;
try {
luckyNumber =
[Link](luckyNumStr);
} catch (NumberFormatException e) {
[Link]("<p
style='color:red;'>Invalid lucky number
entered!</p>");
}
%>
<h2>Collected Information:</h2>
<table border="1" cellpadding="10">
<tr><th>Name</th><td><%= name
%></td></tr>
<tr><th>Birth Date</th><td><%=
birthdate %></td></tr>
<tr><th>Email</th><td><%= email
%></td></tr>
<tr><th>Lucky Number</th><td><%=
luckyNumber %></td></tr>
</table>
</body>
</html>
Output:
Conclusion:
Java Server Pages (JSP) is a powerful technology for developing dynamic and interactive web
applications. It simplifies the process of integrating Java with HTML, making web development more
efficient and maintainable.