Calling a java method in jsp

In the servlet (which runs before the JSP):

Person p = new Person(); // instantiate business object
p.init(...); // init it or something
request.setAttribute("person", p); // make it available to the template as 'person'

In the template you can use this:

your age is: ${person.age}  <%-- calls person.getAge() --%>

Leave a Comment