java
Sat Nov 16 2024 08:42:06 GMT+0000 (Coordinated Universal Time)
Saved by
@login123
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<title>Student Details</title>
</head>
<body>
<h2>Welcome to the Student Portal</h2>
<%
// Get the request parameters
String name = request.getParameter("name");
String age = request.getParameter("age");
// Check if the parameters are available
if (name != null && age != null) {
// Display the student details along with a welcome message
out.println("<p>Hello, " + name + "! Welcome to the portal.</p>");
out.println("<p>Your Age: " + age + " years old.</p>");
} else {
// If no parameters are passed, display an error message
out.println("<p>Error: Missing student details.</p>");
}
%>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Student Details Form</title>
</head>
<body>
<h2>Enter Your Details</h2>
<form action="request.jsp" method="post">
Name: <input type="text" name="name" required><br>
Age: <input type="number" name="age" required><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
content_copyCOPY
Comments