01.
<%@ page
import
=
"com.microsoft.windowsazure.services.core.storage.*"
%>
02.
<%@ page
import
=
"com.microsoft.windowsazure.services.table.client.*"
%>
03.
<%@ page
import
=
"com.microsoft.windowsazure.services.table.client.TableQuery.*"
%>
04.
<%@ page
import
=
"com.java.myapp.CustomerEntity"
%>
05.
06.
<html>
07.
<head>
08.
<title>ThaiCreate.Com Azure Tutorial</title>
09.
</head>
10.
<body>
11.
<%
12.
13.
String storageConnectionString =
14.
"DefaultEndpointsProtocol=http;"
+
15.
"AccountName=[yourAccount];"
+
16.
"AccountKey=[yourKey]"
;
17.
18.
19.
CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString);
20.
21.
22.
CloudTableClient tableClient = storageAccount.createCloudTableClient();
23.
24.
25.
TableQuery<CustomerEntity> partitionQuery =
26.
TableQuery.from(
"customer"
, CustomerEntity.
class
);
27.
28.
29.
out.print(
"<table width=\"800\" border=\"1\">"
);
30.
out.print(
"<tr>"
);
31.
out.print(
"<th width=\"91\"> <div align=\"center\">PartitionKey </div></th>"
);
32.
out.print(
"<th width=\"91\"> <div align=\"center\">RowKey </div></th>"
);
33.
out.print(
"<th width=\"91\"> <div align=\"center\">CustomerID </div></th>"
);
34.
out.print(
"<th width=\"98\"> <div align=\"center\">Name </div></th>"
);
35.
out.print(
"<th width=\"198\"> <div align=\"center\">Email </div></th>"
);
36.
out.print(
"<th width=\"97\"> <div align=\"center\">CountryCode </div></th>"
);
37.
out.print(
"<th width=\"59\"> <div align=\"center\">Budget </div></th>"
);
38.
out.print(
"<th width=\"71\"> <div align=\"center\">Used </div></th>"
);
39.
out.print(
"<th width=\"71\"> <div align=\"center\">Edit </div></th>"
);
40.
out.print(
"</tr>"
);
41.
42.
for
(CustomerEntity entity : tableClient.execute(partitionQuery)) {
43.
out.print(
"<tr>"
);
44.
out.print(
"<td><div align=\"center\">"
+ entity.getPartitionKey() +
"</div></td>"
);
45.
out.print(
"<td><div align=\"center\">"
+ entity.getRowKey() +
"</div></td>"
);
46.
out.print(
"<td><div align=\"center\">"
+ entity.getCustomerID() +
"</div></td>"
);
47.
out.print(
"<td>"
+ entity.getName() +
"</td>"
);
48.
out.print(
"<td>"
+ entity.getEmail() +
"</td>"
);
49.
out.print(
"<td><div align=\"center\">"
+ entity.getCountryCode() +
"</div></td>"
);
50.
out.print(
"<td align=\"right\">"
+ entity.getBudget() +
"</td>"
);
51.
out.print(
"<td align=\"right\">"
+ entity.getUsed() +
"</td>"
);
52.
out.print(
"<td align=\"center\"><a href='update.jsp?CusID="
+ entity.getCustomerID() +
"'>Edit</a></td>"
);
53.
out.print(
"</tr>"
);
54.
}
55.
56.
out.print(
"</table>"
);
57.
%>
58.
</body>
59.
</html>