Statement: Recently looking for a partner to do a social type of app, the ability to contact qq:1126427292
First, study case: about the previous chapter of "Hibernate Ognl detailed" demonstration project many friends said that the back is not very understanding. This chapter will be explained for the moment.
A) The root object is we pass context.setroot ( ... ); set the object, we can set multiple.
b) #, if it is not the root object, use # to fetch the object, otherwise take the object directly.
c) Calling a static method requires the use of @[email protected]. such as:@[email protected] (Ten). If you are calling the method in Math, you can use @@. ... . such as:@ @max (1, 5)
d) for the definition list or array directly using curly braces {}, such as:{' AA ', ' BB ', ' cc ', ' DD '}, access the array of elements directly behind the curly braces using the index method: {...}. [0]
e) the definition of map uses #, which isdifferent from the previous #, which is used to define the map type. such as:#{' key1 ': ' value1 ', ' key2 ': ' value2 '}[' Key3 ']
f) Filter (filtering):The elements in the set (collection) are conditionally filtered by rows, and the returned object is also a collection.
such as:#persons. {? #this. Name.length () > 4}
represents a traversal An object in the persons that satisfies the return of name length greater than 4 in the object .
1. #persons. {^ #this. Name.length () > 4} returns the first object that satisfies the condition. The returned type is a collection.
2. #persons. {$ #this. Name.length () > 4} returns the last object that satisfies the condition. The returned type is a collection.
3. #this represents an object in the collection that is currently being iterated.
g) projection (projection):The Elements in the collection (collection) are conditionally filtered by rows, and the returned object is a collection of properties in the object.
1. #persons. {Name} represents the return persons The collection of name properties for each object in the collection . The return value is:[Zhangsan, Lisi, Wangwu]
2. #persons. {#this. Name.length () <= 5? ' Hello World ': #this. Name} indicates that the name property value of an object in the persons collection is less than or equal to 5 Replace with ' Hello World ' , which is greater than 5, and then returned as a collection.
The return value is:[Zhangsan, Hello World, Wangwu]
h) The difference between filtering and projection: Filtering is the collection of original objects returned, and the projection returns a collection of properties from the original object. Analogous to a table in a database, filtering is a fetch operation, and a projection is a column-fetching operation.
Third, Experience:
A) filtering and projection are seldom used in the project, but once used there will be unintended effects. the knowledge about OGNL is about the same. The following will be used in the Struts2 tab.
Iv. Reference Project: http://download.csdn.net/detail/u011638419/8280245
Five, a day of joy:
A group of ants climbed the back of the elephant, but was shaken down, only one ant clinging to the elephant's neck, the following ants shout: Strangle him, strangle him, sample, and the mother of the reverse!
The final interpretation of the right to college students all. Reprint please indicate the source. @www. 23hhr.com
OGNL basic operation, filtering and projection interpretation of STRUTS2