Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

login form jsp example

Hi,

I am working on below example

http://mrbool.com/how-to-create-a-login-form-with-jsp/25685
my login.html is
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
	<h1>Login Page</h1>
	<center>
		<h2>Signup Details</h2>
		<form action="LoginCheck.jsp" method="post">
			<br />Username:<input type="text" name="username"> <br />Password:<input
				type="password" name="password"> <br />
			<input type="submit" value="Submit">
		</form>
	</center>
</body>
</html>

Open in new window


my LoginCheck.jsp is
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
	<%
		String username = request.getParameter("username");
		String password = request.getParameter("password");
		if ((username.equals("anurag") && password.equals("jain"))) {
			session.setAttribute("username", username);
			response.sendRedirect("Home.jsp");
		} else
			response.sendRedirect("Error.jsp");
	%>
</body>
</html>

Open in new window


i ran application and entered anurag and jain as username and password within login.html
i expected to go to LoginCheck.jsp but getting below error

http://localhost:9999/FinalWeb/Home.jsp
please advise

HTTP Status 404 - /FinalWeb/Home.jsp


type Status report

message /FinalWeb/Home.jsp

description The requested resource is not available.


Apache Tomcat/7.0.47

not sure where Home.jsp came in picture??

my intention is once login successful come to a page with 4 different links like menu.
one link says create account
second link say perform credit operatin
then show like receipt etc
ASKER CERTIFIED SOLUTION
Avatar of mccarl
mccarl
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gudii9

ASKER

that make sense