Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using multiple instances of a class

Status
Not open for further replies.

rabix

Programmer
Apr 23, 2001
12
CH
hi ,
i got a few jsp doubts. could anyone please help me?
i am want use of many instance of a class in a jsp page. how is this possible.
class Isured{
public int getCost(){
return cost;
}
public void setCost}
........;
}
}



and there are two or more instances of this class Insured.

the jsp page is something like this.


<%@ page language='java' import=&quot;Insured&quot; %>


....

<jsp:useBean id=&quot;InsuredBean&quot; class=&quot;Insured&quot;/>




and when i use the get method i can access the values. but if i have multiple instances of the class how can it be displayed in the jsp page? is using vector a correct method? if so could u tell me how?

please reply immediately.
Rabix
 
U can instanciate the bean with new ID.

like

<jsp:useBean id=&quot;InsuredBean&quot; class=&quot;Insured&quot;/>
<jsp:useBean id=&quot;InsuredBean1&quot; class=&quot;Insured&quot;/>

/
 

&quot;
and when i use the get method i can access the values. but if i have multiple instances of the class how can it be displayed in the jsp page? is using vector a correct method? if so could u tell me how?&quot;

well 135790 is correct and

each instance maintain its own value to get diplayed don't get worried.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top