8b. Write a JAVA JSP Program to implement verification of a particular user login and display a welcome page.
//index.jsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<form method="post" action="jsp8b.jsp" >
User name <input type="text" name="uname" />
Password <input type="password" name="pwd" />
<input type="submit" value="Login" />
</form>
</body>
</html>
//jsp8b.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
String u=request.getParameter("uname");
String p=request.getParameter("pwd");
if ((u.equals("admin"))&& (p.equals("rose")))
out.println("Welcome "+u+" you are authenticated");
else
out.println("Failed Login Attempt");
%>
</body>
</html>
Thursday, 12 February 2015
8b. Write a JAVA JSP Program to implement verification of a particular user login and display a welcome page.
Labels:
J2EE

No comments:
Post a Comment