Reputation: 37078
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.
I have restriction that I cannot use scriplets
Upvotes: 1
Views: 503
Reputation: 4192
There is another way. You can make a simple Bean which gets this value
public String getDATE(){
String Date = String.valueOf(new java.util.Date());
return Date;
}
and then call the above method with the following jsp tag
<jsp:useBean id="now" class="beans.PropertyBean" />
<jsp:getProperty name="now" property="DATE" />
you can use anything returned from the bean, In above snippet 'PropertyBean' is the name of my custom bean class. Hope this answers your question.
Upvotes: 0
Reputation: 122018
You can do that using expression language. For ex
Assuming that you've a ${instance} in the scope
${instance.get(1,"test")}
Upvotes: 2