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

http://developer.java.sun.com/developer/onlineTraining/JSPIntro/contents.html#JSPIntro11

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact