How can I instantiate an object of a class(MyClass) within a JSP page ?

Govind Seshadri

Answer by Vasu devan

You can do it as follows:

<%@ page import="MyClass"%>
<% MyClass myObj=new MyClass(); %>
Make sure you import the correct package.

You can also use the usebean tag, where you can specify the scope of the object.
For more details, see