Ok heres the scriplet i am trying to avoid balance.getUsers().getUser(0).getUserId();
Ok i am trying it with EL ${balance.users.user[0].userId}
and obviously it doesnt work because getUser(0) takes parameter and i am using user[0], but i dont know how to pass in arguments with EL to call getUser(0). Any idea?
getUser(int x) returns a User object which is a POJO. I don't know how to invoke getUser which takes an int as parameter with EL notation. I didn't find any examples. Is it possible? Thanks
You are making a classic mistake of designing your data and then figuring out how to access it with the EL rather than designing the data to make the EL access easier.
Ask yourself, why does getUser() need to take an int as a parameter? Since we know that the EL cannot call general methods and pass parameters, what structure would serve the purpose better?
Originally posted by O Affan: Unfortunately I am using old code that calls getUser(0) and i cannot change it! Oh well will have to use scriplets. Thanks for helping!
Can you subclass it and then provide your own getter?