Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP Bean  RSS feed

 
pankaj patil
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

problem is

i have 3 pages
in each page i call bean and i have written connection in the constructor. scope of the bean is session.
dose it mean that the constructor is called on each page.

With regards
Pankaj
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in each page i call bean


Does that mean you are using the <jsp:useBean..> utility ? In which case
here's what the spec says


The <jsp:useBean> element locates or instantiates a JavaBeans component. <jsp:useBean> first attempts to locate an instance of the Bean. If the Bean does not exist, <jsp:useBean> instantiates it from a class or serialized template.


If you have written a scriptlet to instantiate the bean, then yes- the constuctor would be called that many times.

cheers,
ram.

PS: I hope you are closing all those connections after usage. Better, use a
datasource to maintain the connections for you.
 
pankaj patil
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!