📄 ex4_9.txt
字号:
Example 4.9 Conversion Logic Embedded Within View
<html>
<head><title>Employee List</title></head>
<body>
<h3><head><center> List of employees</h3>
<%
String firstName =
(String)request.getParameter("firstName");
String lastName =
(String)request.getParameter("lastName");
if ( firstName == null )
// if none specific, fetch all
firstName = "";
if ( lastName == null )
lastName = "";
EmployeeDelegate empDelegate = new
EmployeeDelegate();
Iterator employees =
empDelegate.getEmployees(
EmployeeDelegate.ALL_DEPARTMENTS);
%>
<table border="1" >
<tr>
<th> First Name </th>
<th> Last Name </th>
<th> Designation </th>
</tr>
<%
while ( employees.hasNext() )
{
EmployeeVO employee = (EmployeeVO)
employees.next();
if ( employee.getFirstName().
startsWith(firstName) &&
employee.getLastName().
startsWith(lastName) ) {
%>
<tr>
<td><%=employee.getFirstName().toUpperCase() %></td>
<td> <%=employee.getLastName().toUpperCase() %></td>
<td> <%=employee.getDesignation()%></td>
</tr>
<%
}
}
%>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -