0% found this document useful (0 votes)
14 views2 pages

JSP Form Validation Example

This document describes a form validation experiment using JSP. The experiment has an index.jsp page with a form for username and password. The form action goes to a login.jsp page that checks the submitted username and password and displays a success or failure message.

Uploaded by

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

JSP Form Validation Example

This document describes a form validation experiment using JSP. The experiment has an index.jsp page with a form for username and password. The form action goes to a login.jsp page that checks the submitted username and password and displays a success or failure message.

Uploaded by

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

Experiment – 7

Code
[Link]
<% @page contentType = "text/html" pageEncoding = "UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<title> Form validation </title>
<meta charset = "UTF-8">
<meta name = "viewport" content = "width = device-width, initial-scale = 1.0">
<style>
Input {
margin: 10px;
}
Body {
background-color:#2c74c7;
text-align:center;
}
</style>
</head>
<body>
<div>Form Validation using JSP</div>
<form action = "[Link]" method="POST">
<label> Enter your Username: </label>
<input type = "text" name = "uname">
<br>
<label>Enter your Password: </label>
<input type = "password" name = "pswd">
<br>
<input type = "submit">
</form>
</body>
</html>

[Link]

<%
String username = [Link](" uname ");
String password = [Link](" pswd ");
if([Link](" admin ") && [Link](" admin") ) {
[Link](" You are logged in!! ");
} else {
[Link](" Try Again!! Wrong Credentials ");
}
%>

Output:

You might also like