Java Reference
In-Depth Information
<meta http-equiv="Content-Type" content="text/html;
<title>JSP Page</title>
<h2>Hello World!</h2>
<table border="1" cellpadding="1" cellspacing="0">
<th>First Name</th>
<th>Last Name</th>
<c:forEach var="customer"
Notice at the top of the JSP, the ArrayList we attach to the session instances of a
class called CustomerBean . This class is a simple JavaBean with two properties,
firstName and lastName . In the body of the <c:forEach> tag, we access the getter
methods for these properties by simply entering the name of the property after the
name we gave for the current item in the list (customer). For example, to invoke
the getFirstName() getter method in CustomerBean , we simply need to type
${customer.firstName} inside the body of the <c:forEach> tag. This notation
allows us to easily invoke getter methods in JavaBeans from JSTL expressions. The
notation can be used with any expression that resolves to a JavaBean, it is not limited
to the body of a <c:forEach> tag.
Search WWH ::

Custom Search