-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhome1.jsp
More file actions
44 lines (39 loc) · 1.24 KB
/
home1.jsp
File metadata and controls
44 lines (39 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="model.Customer"%>
<html>
<body>
<%
List<Customer> customerList = (ArrayList<Customer>) request.getAttribute("list");
for (Customer ref : customerList) {
out.print("Id: " + ref.getCustomerId());
out.print("<br/>");
out.print("Name: " + ref.getCustomerName());
out.print("<br/>");
out.print("Address: " + ref.getCustomerAddress());
out.print("<br/>");
out.print("PaymentMode: " + ref.getPaymentMode());
out.print("<br/>");
}
%>
<%
Integer hitsCount = (Integer)application.getAttribute("hitCounter");
if( hitsCount ==null || hitsCount == 0 ) {
/* First visit */
out.println("Welcome to my website!");
hitsCount = 1;
} else {
/* return visit */
out.println("Welcome back to my website!");
hitsCount += 1;
}
application.setAttribute("hitCounter", hitsCount);
%>
<center>
<p>Total number of visits: <%= hitsCount%></p>
</center>
</body>
</html>