0% found this document useful (0 votes)
6 views1 page

6b jsp2

The document is a JSP page for a login system created by the author 'kanoo' on February 11, 2025. It connects to a Derby database to validate user credentials and includes logic for successful and failed login attempts. If the login is successful, it redirects to a welcome page; otherwise, it displays a login failure message and redirects back to the index page.

Uploaded by

Abdulaziz Kanoor
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)
6 views1 page

6b jsp2

The document is a JSP page for a login system created by the author 'kanoo' on February 11, 2025. It connects to a Derby database to validate user credentials and includes logic for successful and failed login attempts. If the login is successful, it redirects to a welcome page; otherwise, it displays a login failure message and redirects back to the index page.

Uploaded by

Abdulaziz Kanoor
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
You are on page 1/ 1

C:/Users/kanoo/OneDrive/Documents/NetBeansProjects/prac6c/web/login.

jsp
<%--
Document : login
Created on : 11 Feb, 2025, 8:38:51 PM
Author : kanoo
--%>
<%@page contentType="text/html"%>
<%@page import="java.sql.*" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
try
{
Class.forName("org.apache.derby.jdbc.ClientDriver");
Connection
con=DriverManager.getConnection("jdbc:derby://localhost:1527/2804","root","
root");
String uname=request.getParameter("uname");
String pwd=request.getParameter("pwd");
PreparedStatement pst=con.prepareStatement("Select password
from registration where username='"+uname+"'");
ResultSet rs=pst.executeQuery();
if(rs.next())
{
if(rs.getString(1).equals(pwd))
{
%>
<%@include file="welcome.html" %>
<%
}
else
{
%>
<h1>LOGIN FAILED</h1>
<%@include file="index.jsp" %>
<%
}
}
else
{

%>
<%="User doesn't Exists"%>
<%@include file="index.jsp"%>
<%
}
}catch(Exception e)
{
out.println(e);
}

%>
</body>
</html>
1.1 of 1 2025.02.11 20:54:38

You might also like