struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Struts Wiki] Update of "StrutsQuickStartJSP" by MichaelJouravlev
Date Wed, 21 Feb 2007 00:27:05 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Struts Wiki" for change notification.

The following page has been changed by MichaelJouravlev:
http://wiki.apache.org/struts/StrutsQuickStartJSP

New page:
== Employee list with pure JSP (Model 1) ==

Before the data list is displayed, it should be retrieved from a database and saved into appropriate
J2EE scope like request, session or application. Then the list is iterated and its content
is shown line by line. Notice JSTL 2.0 usage.

inline:employee_list.gif

{{{<%@ page import="java.util.ArrayList, model.EmployeeManager"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%-- Load data from the storage --%>

<%
    if (session.getAttribute("employees") == null) {
        session.setAttribute("employees", EmployeeManager.loadEmployees());
    }
%>

<%-- Display data --%>

<html>
  <body>
    <table>
      <tr>
        <th align="left">Emp #</th>
        <th align="left">Name</th>
        <th align="left">Salary</th>
      </tr>
      <c:forEach var="employee" items="${employees}">
        <tr>
          <td>${employee.id}</td>
          <td>${employee.name}</td>
          <td>${employee.salary}</td>
        </tr>
      </c:forEach>
    </table>

  </body>
</html>}}}

Mime
View raw message