Search code examples
javajspjstlscriptlet

How to access to object method called "get" on jsp to avoid using scriplets?


I have following library class:

public class LibClass{
    public int get(int a, String b) {
        ....
        return 12;
    }
}

How to invoke following method on jsp?

I want to render 12 on jsp.

P.S.

I have restriction that I cannot use scriplets


Solution

  • You can do that using expression language. For ex

    Assuming that you've a ${instance} in the scope

    ${instance.get(1,"test")}