开发者

Spring 3 pet clinic example uses ${owner.new}, in the JSTL EL where can I read about out about .new operator?

开发者 https://www.devze.com 2022-12-23 09:10 出处:网络
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 o

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); }
0

精彩评论

暂无评论...
验证码 换一张
取 消