I have a bean (DBBean) I put in session scope that I use to connect to the database…

Some other beans need to connect to the database for some processing and do it using DBBean.

 

My question is:

How do I pass the reference to DBBean to the other beans?

 

I’ve tried something like:

<jsp:useBean id="db" class="beans.DBBean" scope="session"/>

<jsp:useBean id=”someBean” class=”beans.someBean” scope=”page”/>

<% someBean.setDBBean(db); %>

 

No luck… I get a servletException, noSuchMethod Error… But the method exists!! If I mess up with the number of arguments it will say the num of args is wrong!!

Also tried to put a method in DBBean like this:

public DBBean getRef() { return this; }

 

Same problem…

 

Any help?? I’m open to any other ideas of getting references from one bean to the other!!

 

Thanks in advance…

 

Ricardo Rocha

Reply via email to