Hi,
We were asked to make a subscription type of form. Details needed are username, password, first name, last name, etc. My problem has something to do with the password validation. when i feel in the password field and the re-type password field, both of them should be checked. If both are the same, it will be redirected to a "success page" after clicking the submit button. But if both passwords don't match, a short "error page" should be included and displayed at the bottom of the same page after clicking the submit button. I can't get it to include the short error page on the same page after clicking the submit button. I am using "IBM RAD" for this. Here's what I've got so far:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Main Page</title>
</head>
<body>
<form name="frm" action="exer02-b.jsp" method="post">
Please fill in the blanks below:<hr>
<p>Username: <input type="text" name="user" size="20"></p>
<p>Password: <input type="password" name="pass1" size="20"></p>
<p>Re-type password: <input type="password" name="pass2" size="20"></p><hr>
<p>First name: <input type="text" name="firstname" size="20"></p>
<p>Last name: <input type="text" name="lastname" size="20"></p>
<p>Gender: <input type="radio" name="gender" checked>female <input type="radio"
name="gender">male</p>
<input type="reset" name="res" value="Reset"> <input type="submit" name="sub" value="Submit">
<% if ( !("pass2").equals("pass2") ) { %>
<%@ include file="errorpage.html" %>onClick
<%} %>
</form>
</body>
</html>
I would appreciate anyone that would kindly help me with this problem. Thanks! :)