Forums Register Login

jsp and local interfaces

+Pie Number of slices to send: Send
Can we lookup a entity beans local interface through action classes (Struts)?
+Pie Number of slices to send: Send
In WebSphere you can even access local ejb directly in jsp page
+Pie Number of slices to send: Send
How do you do the jndi lookup? Can you give an example.
+Pie Number of slices to send: Send
Hello Victor Larr,
In WebSphere you can even access local ejb directly in jsp page
1. Does the above behaviour happen only if the web application and enterprise bean are in the same JVM?
2. Is the above behaviour true if the web application and enterprise bean are in different JVM's (I think the above behaviour will not be exhibited in case number 2, if it does then I don't understand EJB's )?

Sany Bel -->

Can we lookup a entity beans local interface through action classes (Struts)?

I think you can if struts application and enterprise bean are in same JVM otherwise not.
Thanks,
Santosh
+Pie Number of slices to send: Send
Yes you can access local EJB only if web container and ejb container runs inside the same JVM. For ejb lookup you put the same code in jsp as in a regular java class.
<%
Context context = new InitialContext();
MyEJBHome home = (MyEJBHome)context.lookup("myEJB");
MyEJB ejb = home.create();
%>
It is good for testing. But in a real development this code should be moved to a helper class.
This is my favorite show. And this is my favorite tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 800 times.
Similar Threads
String operation
Did implicit objects are instance variables or local variables in _jspService
object/collection modification
Resource Local Transactions
Are variables defined inside a constructor instance or local?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 03:54:24.