A JSP not only can interact with a JavaBean (previous tutorial) but also can interact with a normal Java class. To do so, we use JSP page directives. In this tutorial, we will see how a JSP interacts with a Java class.
public double square(double x){ return Math.pow(x, 2); }
<%@ page import="calculation.basic.*" %> <% Calculation c=new Calculation(); %> 2 square is <%= c.square(2) %>