Quantcast

OGNL expressions?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

OGNL expressions?

Frank LaRosa
The MyBatis documentation says: "MyBatis employs powerful OGNL based expressions to eliminate most of the other elements.". It then goes on to show an example "if" statement that looks like this:

<if test=”title != null”>

I do not know what an OGNL expression is. I'm assuming that the part which reads "title != null" is such an expression. I expected the documentation to further explain to me what other OGNL expressions exist so I could figure out what else is possible in an if statement, but it does not.

What I'm trying to do is write an if statement that selects based on the existence of an enum in a set. In Java, the expression I would write is "mySet.contains(SOME_ENUM.SOME_VALUE)", where SOME_ENUM is an enum and mySet is a Set<SOME_ENUM>. If it is not directly possible to do this in myBatis, I would settle for passing in the values as a set of String. Or perhaps I could create an int that sets a bit for each possible enum value, although for this to work I would need access to bitwise operators in the "OGNL" expression.

If someone could help me out here, and/or point me to some documentation that fully explains my options, I would appreciate it.

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: OGNL expressions?

Eduardo Macarron
An introduction from the wikipedia

http://en.wikipedia.org/wiki/OGNL

The languaje guide:

http://commons.apache.org/ognl/language-guide.html
Loading...