Java Reference
In-Depth Information
The
catalog.jsp
JSP gets added to the
webModule
folder. The
catalog.jsp
is shown
below, including the JSP code, which we shall discuss next:
We shall create an instance of
CatalogTestRemote
using JNDI lookup for which
we need to create an
InitialContext
object. We need to set the
InitialContext
environment using the environment properties:
InitialContext context = new InitialContext();
Obtain a
CatalogTestBeanRemote
instance using remote JNDI lookup on the session
bean remote object. The JNDI name for WebLogic server is of the format
mapped_
name#remote_interface_class_name
.
CatalogTestBeanRemote beanRemote = (CatalogTestBeanRemote) context.
lookup("EJB3-SessionEJB#ejb3.CatalogTestBeanRemote");
Invoke the
test()
method of the session bean and output the
String
returned, as
shown next:
String catalog=beanRemote.test();
The test client JSP is listed next:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
Search WWH ::
Custom Search