%@ page import="com.apz.pirisale.*" %>
<%! int mNumHits = 0; %>
<%
mNumHits++;
Item[] mItem;
String mCustomerName = null;
try{ mItem = piriSale.getItems().getItems(); }
catch(Exception e)
{
response.sendRedirect("error.jsp?errorText=" + e.toString());
return;
}
boolean mActive = (session.getAttribute("active") != null);
if (mActive)
{
Object objCustomerID = session.getAttribute("customerID");
if (objCustomerID != null)
{
String szCustomerID = ((String)objCustomerID).toString();
try
{
long mCustomerID = (long)Long.parseLong(szCustomerID);
try
{
Customer currentCustomer = piriSale.getCustomers().getCustomer(mCustomerID);
if (currentCustomer != null)
{
mCustomerName = currentCustomer.getFirstName();
}
else
{
response.sendRedirect("error.jsp?errorText=CustomerID doesn't exist");
return;
}
}
catch(Exception e)
{
response.sendRedirect("error.jsp?errorText=" + e.toString());
return;
}
}
catch(NumberFormatException e)
{
response.sendRedirect("error.jsp?errorText=Customer ID is not numeric");
return;
}
}
else
{
response.sendRedirect("error.jsp?errorText=Customer not initialised");
return;
}
}
%>
PIRISALE.COM - Your first choice for Internet Piri
<%
if (!mActive) out.write("Welcome to piriSale.com. To sign on, click here ");
if (mActive) out.write("Welcome back to piriSale.com " + mCustomerName + "!");
%>
PIRISALE.COM - Your first choice for Internet Piri
Welcome to PiriSale.com - Your first choice for Internet Pioraj
EC201 Assignment 1
Alan Pinder - s0304612
PiriSale.com is a registered trademark of apz.inc. You are visitor number <%= mNumHits %>