OGNL Part 8: Lambda without closures
The part 7 is a tutorial on Selection. Here I explain the very easy example from the OGNL language guide. This is factorial function as shown in the following example.
package au.com.ojitha.ongl; import ognl.Ognl; import ognl.OgnlException; public class Lambda { /** * @param args * @throws OgnlException */ public static void main(String[] args) throws OgnlException { System.out.println(Ognl.getValue( "#fact = :[#this <=1 ? 1 : #this*#fact(#this-1)], #fact(4)", null)); } }
The output is 4*3*2*1=24.
Comments
Post a Comment
commented your blog