Spring 3 pet clinic example uses ${owner.new}
, in the JSTL EL where can I find out more about where the .new comes from and what spec it is a part of? Ive seen empt开发者_StackOverflowy and not empty operators/ reserved words but not .new until now in the Spring 3 pet clinic example.hers is the line im questioning:
<h2><c:if test="${owner.new}">New </c:if>Owner:</h2>
located in the ownerForm.jsp file in the spring 3 pet clinic sample application.
In the expression ${owner.new}
, the dot operator is used to access a property named new
of the object referenced by the owner
identifier. The EL accesses object properties using the Java beans conventions, so a getter for this property (typically a method named getXxx()
or... isXxx()
for a boolean
) must be defined in order for this expression to evaluate correctly.
And if you look at org.springframework.samples.petclinic.Entity
(a simple JavaBean superclass used for all persistable objects), guess what, you'll see:
public boolean isNew() { return (this.id == null); }
精彩评论