menu.jsp
<%@ page import="persistenceexample4.PersistenceExample" %>
<!-- Definition of the absolute font size so that table fits on a PDA -->
<%! String FontSize="2"; %>
<html>
<head>
<link rel="stylesheet" href="css/mi.css" type="text/css">
</head>
<body>
<jsp:useBean id="dataHandler" scope="session" class="persistenceexample4.bean.BasicDataHandler" />
<jsp:useBean id="tableViewDefinition" scope="session" class="persistenceexample4.bean.TableViewDefinition" />
<!-- For event handling we need a HTML "form" command -->
<form method="post" action="start" id="<%=tableViewDefinition.getFormName() %>" name="<%=tableViewDefinition.getFormName() %>" >
<font face="'Arial Narrow',sans-serif">
<!-- Display header panel -->
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#fffbd5">
<tr bgcolor="#fffbd5" class="headerPanel">
<td align="left" valign="middle" class="headerPanel" ><%=tableViewDefinition.getHeaderPanelEntryLeft() %> </td>
<td align="right" valign="middle" class="headerPanel" ><%=tableViewDefinition.getHeaderPanelEntryRight()%> </td>
</tr>
</table>
<!-- Command line - contains the commands add, delete etc.. The commands are separated by 2 blanks-->
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#fffbd5">
<tr bgcolor="#fffbd5">
<td class="commandLine"><%=tableViewDefinition.getCommandLine("")%></td>
</tr>
<tr bgcolor="#fffbd5">
<!-- Title -->
<td class="centerPageTitle"><%=tableViewDefinition.getCenterPageTitle()%></td>
</tr>
</table>
<!-- Table definition -->
<table width="100%" bgcolor="#D4E2EE" border="1" cellpadding="0" cellspacing="0">
<%
int cols = tableViewDefinition.getTableColumns();
int rows = tableViewDefinition.getTableRows();
// Background color for title row
String bgColor = "#9CAECE";
String rowClass = "miHeader";
String cellClass = "1stCellHeader";
// begin table with table header
%> <tr bgcolor="<%=bgColor %>" class="<%=rowClass%>" > <%
for(int j=0; j < cols; j++) {
// In the first column (except the title row) we display a checkbox, that can be used to mark an entry
/// that should be deleted. The checkbox gets the name which is supplied by the tableViewDefinition. This name is
/// used in the servlet to determine which entry should be deleted
%> <td align="left" valign="middle" class="<%=cellClass%>" ><%=tableViewDefinition.getHeaderContent(j)%> </td> <%
cellClass = "nextCellHeader";
}
rowClass = "miBody";
// end of a row
%> </tr> <%
rowClass = "miBody";
bgColor = "#DCE3EC";
for(int i=0; i < rows; i++) {
cellClass = "1stCellBody";
// begin of a row
%> <tr bgcolor="<%=bgColor %>" class="<%=rowClass%>" > <%
for(int j=0; j < cols; j++) {
// In the first column (except the title row) we display a checkbox, that can be used to mark an entry
/// that should be deleted. The checkbox gets the name which is supplied by the tableViewDefinition. This name is
/// used in the servlet to determine which entry should be deleted
if (j == 0) {
%> <td width="20px" align="center" valign="middle" class="<%=cellClass%>" > <INPUT TYPE="CHECKBOX" Name="<%=dataHandler.getCurrentSubTableContent(i, j)%>" Value="<%=dataHandler.getCurrentSubTableContent(i, j)%>"></td> <%
} else {
// Column 2 and higher displays the Car entity and License entity. We display the entry in HTML encoded.
/// If the string is empty we display a non breaking space so that the table gets the separation lines.
String value = dataHandler.getCurrentSubTableContent(i, j);
if (value.trim().length() < 1){
value = " ";
} else {
value = PersistenceExample.encodeForHtml(value);
// 2 column = make. Represent that as link so that it can be selected to get car details
if (j == 1){
value = "<a href=\"?event=" + dataHandler.getCurrentSubTableContent(i, 0) + "\" >"+value+"</a>";
}
}
%> <td align="left" valign="middle" class="<%=cellClass%>" ><%=value%> </td> <%
}
cellClass = "nextCellBody";
}
// end of a row
%> </tr> <%
// To make the tableview look nicer, we use alternating colors for rows (light blue and light grey)
if (bgColor.compareTo("#DCE3EC") == 0) {
// light blue
bgColor = "#CBD5E1";
} else {
// lighter blue
bgColor = "#DCE3EC";
}
}
%>
</table>
</form>
<form method="post" action="start" id="MIFormFooter" name="MIFormFooter" >
<!-- Table for navigation. The navigation icons including the eventhandler reference is generated in the bean -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="middle">Page <input type="text" name="GOTO_PAGE" size="2" value="<%=tableViewDefinition.getCurrentPage()%>"> /<%=tableViewDefinition.getMaxPage()%> <%=tableViewDefinition.getGotoIcon()%></td>
<td align="right" valign="middle">
<%=tableViewDefinition.getTopIcon()%><%=tableViewDefinition.getPageupIcon()%><%=tableViewDefinition.getPagedownIcon()%><%=tableViewDefinition.getBottomIcon()%>
</td>
</tr>
</table>
<!-- Display footer panel -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#eff6fb" class="footerpanel" >
<td align="left" valign="middle" class="footerPanel" ><%=tableViewDefinition.getFooterPanelEntryLeft() %> </td>
<td align="right" valign="middle" class="footerPanel"><%=tableViewDefinition.getFooterPanelEntryRight()%> </td>
</tr>
</table>
</font>
</form>
</body>
</html>