This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
First of all you might be aware that this is not a good practice with SFSB. This especially because SFSBs suppose to be single threaded and in case of receiving two concurrent requests from two different clients, your container might throw an exception. The second observation it�s a common problem with ejb handles: if the container passivates/removes the bean instance, then your handle is useless. Having said that, you have two choices: either to add the handle to the session or to serialize the handle to a common directory. For the first case you still have to worry about the case when your server fails and the session needs to be recovered. In this case you might recover your handle or you might not. The second scenario will save the handle in all circumstances. You need your first JSP to serialize the handle like this:
While the second JSP will get the handle from the common folder:
As Valentin explained, It is not a good practice to share the handle of SFSB. Further, Serializing the handle in a common subfolder is again a risk. In most corporate applications, load balancing is very common and folder can not be shared. So keeping in that mind, think about better viable solution to your need.
Thanks,<br />Bhanu<br />SCEA Step-I<br />SCBCD for J2EE 1.3<br />SCJP1.4