Java Reference
In-Depth Information
<jndi-name>EJB3-SessionEJB</jndi-name>
</business-interface-jndi-name-map>
</stateless-session-descriptor>
</weblogic-enterprise-bean>
We shall use the first method. Create a remote business interface instance using
lookup with the mapped name:
CatalogTestSessionEJB beanRemote = (CatalogTestSessionEJB) context.
lookup("EJB3-SessionEJB#model.CatalogTestSessionEJB");
Invoke the test() method of the session bean:
String catalog=beanRemote.test();
Output the string returned by the test method:
<%=catalog %>
The EJB3Client is listed next:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="model.*, javax.naming.*" %>
<%@ page
contentType="text/html;charset=windows-1252"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252" />
<title>EJB3Client</title>
</head>
<body><% InitialContext context = new InitialContext();
CatalogTestSessionEJB beanRemote = (CatalogTestSessionEJB)
context.lookup("EJB3-SessionEJB#model.CatalogTestSessionEJB");
String catalog=beanRemote.test(); %><%=catalog %></body>
</html>
Testing the client
To run the test client, right-click on, EJB3Client.jsp and select Run .
 
Search WWH ::




Custom Search