I'm trying to move from one JSP page to another , but after the user hits the name and the password , it just stays the the same page . Here's the complete code:
Here's index.jsp: I'm starting from this page
<%@ page language="java" contentType="text/html; charset=windows-1255"
pageEncoding="windows-1255"%>
<!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=windows-1255">
<title>Insert title here</title>
</head>
<body>
<form action="LoginServlet" method="POST">
First Name: <input type="text" name="firstName" size="20"><br>
Last Name: <input type="text" name="lastName" size="20">
<br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
Here's is student.jsp : I want to move to this page
<%@ page contentType="text/html; charset=utf-8" language="java"%>
<jsp:useBean id="userBean" class="UserBean" scope="session" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="css/style2.css" />
<title>Student Access Details</title>
</head>
<body>
<table>
<tr>
<td rowspan="4" class="align_top"><img src="img/photo.jpg" width="120" height="120" /></td>
<td class="align_top">Student name: </td>
<td class="bold"><%= userBean.getFirstName() %> <%= userBean.getLastName() %></td>
</tr>
<tr>
<td class="align_top">University ID: </td>
<td><%= userBean.getUid() %></td>
</tr>
<tr>
<td class="align_top">Address: </td>
<td><%= userBean.getAddress1() %><br />
<%if(userBean.getAddress2() != null)
{%>
<%= userBean.getAddress2() %><br /><%}%>
<%= userBean.getCity() %><br />
<%= userBean.getPostCode() %><br />
</td>
</tr>
<tr>
<td class="align_top">Contact: </td>
<td>Tel: <%= userBean.getPhone() %><br />
Email: <%= userBean.getEmail() %>
</td>
</tr>
</table>
</body>
</html>
I'm using Tomcat ,JDBC , XAMPP and MySQL
.
When I run from the browser this line : http://localhost:8080/MyFirstServlet
I enter this page and I hit homer
& simpson
:
Then I just stay at the same page , here :
Any idea what I'm doing wrong ? Thanks !