Today, I found two methods in the el expression in the code. I don't know if it can be used like this, but no error is reported and the value can be obtained correctly. The first one: the second one: this is the final Subtotal (only this one is changed), so we can get the value. What are the regions of the two types... today, I found two methods in the el expression in the code. I don't know if it can be used like this, but no error is reported and the value can be obtained correctly.
First:
I believe that when you read the document (pay attention to the selected part), you will know that direct access to properties does not mean that the EL expression has the permission to access the private attribute of a JavaBean, instead, the data is obtained by automatically calling the getProperty method.
In your question, since $ {orderItem. getSubtotal ()} is available, it indicates that you actually provide the getter method, you can also directly obtain data using the attribute name.
To be accurate, the attribute name is used to obtain the data through the getter method.
In fact, the specific implementation of the first writing method is also a callGetSubtotal ()There is no difference between the two methods.
*. Abc *. getAbc ()
No difference,After. abc is processed, it still becomes. GetAbc ()
In this way, we can draw a conclusion that all getter methods can be set to. attribute values.