0% found this document useful (0 votes)
8 views3 pages

Java Servlet Session Management Lab

The document outlines a simple Java Server Pages (JSP) application that includes three files: index.jsp for user input, first.jsp for processing the input and validating credentials, and second.jsp for displaying a welcome message. The application checks if the entered name and password match predefined values and manages user sessions accordingly. If the credentials are correct, the user is redirected to the second page; otherwise, they are sent back to the input page.

Uploaded by

Abhijith Hari
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Java Servlet Session Management Lab

The document outlines a simple Java Server Pages (JSP) application that includes three files: index.jsp for user input, first.jsp for processing the input and validating credentials, and second.jsp for displaying a welcome message. The application checks if the entered name and password match predefined values and manages user sessions accordingly. If the credentials are correct, the user is redirected to the second page; otherwise, they are sent back to the input page.

Uploaded by

Abhijith Hari
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ADVANCED JAVA AND J2EE LAB 7

ABHIJITH H
[Link].U3CSC19001

A servelet should receive a parameter from JSP page and process it.

a. [Link]

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<title>Session Management Example</title>
</head>
<body>
<form method="post" action="[Link]">
<font size=5>Enter your name<input type="text" name="name"></font><br><br>
<font size=5>Enter your password<input type="password" name="password">
</font><br><br>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

b. [Link]
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<%
String name = [Link]("name"); String password
= [Link]("password"); if
([Link]("amrita") && [Link]("1234")) {
[Link]("username", name);
[Link]("[Link]");
} else {
[Link]("[Link]");
}
%>
</html>
c. [Link]

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
Hello <%= [Link]("username") %>
</body>
</html>

OUTPUT

You might also like