Search code examples
javareflectionmvel

How can i access the inner object values of an object in mvel?


Object obj=account; here account object contains books as inner object. So how can i access those values in mvel.

I am new to MVEL. So can you please auggest me how to overcome the above issue.


Solution

  • MVEL works on OGNL.

    Let say Account.Class has Books.class

    1.) Simple object , not a collection

    OGNL - account.books.bookName

    2.) Complex object, a collection (Account.class has collection of Books.class)

    OGNL - account.books[0].bookName

    or Take collection out and put one by one.

    book.bookName
    

    This is what can be explained simply, otherwise scope of your question is big and not much clear.