It's not a secret anymore!
The moose likes JSP and the fly likes PetStore cart.jsp question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "PetStore cart.jsp question" Watch "PetStore cart.jsp question" New topic

PetStore cart.jsp question

Peter Lee

Joined: Jun 25, 2003
Posts: 24
HI all,
Referring to Petstore 1.3.2 source code cart.jsp, why in following line 5, it can refer to cart directly without declaring cart before?
1: <%@ taglib prefix="waf" uri="/WEB-INF/waftags.tld" %>
2: <%@ taglib prefix="c" uri="/WEB-INF/c.tld" %>
3: <%@ taglib prefix="fmt" uri="/WEB-INF/fmt.tld" %>
4: <c:choose>
5: <c:when test="${cart.count == 0}">
6: <p class="petstore_title">Your Shopping Cart is Empty.</p>
7: </c:when>
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63552

In the EL, an unqualified name, such as cart in this example, is expected to be a scoped variable in one of page, request, session or application scopes. Because there is no qualification, the EL will search the scopes for "cart" in that order.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: PetStore cart.jsp question
It's not a secret anymore!