-
Notifications
You must be signed in to change notification settings - Fork 0
/
validateUserLogin.jsp
36 lines (35 loc) · 985 Bytes
/
validateUserLogin.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<%@page import="com.daoimpl.UserDAOImpl"%>
<%@page import="com.dao.UserDAO"%>
<%@ 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>
<div class="container">
<%
String uid = request.getParameter("txtUid");
String pass = request.getParameter("txtPassword");
%>
<jsp:useBean id="user" class="com.model.User">
<jsp:setProperty property="userid" value="<%=uid%>" name="user"></jsp:setProperty>
<jsp:setProperty property="password" value="<%=pass%>" name="user"></jsp:setProperty>
</jsp:useBean>
<%
UserDAO daoImpl = new UserDAOImpl();
if (daoImpl.checkUser(user)) {
session.setAttribute("USER", uid);
response.sendRedirect("userhome.jsp");
} else {
%>
<p style="color: red">userid or password didn't match !!!</p>
<jsp:include page="userlogin.html"></jsp:include>
<%
}
%>
</div>
</body>
</html>