36
"-//w3c//dtd html 4.0 transitional//en"
out.println("
out.println("
out.println("RegionServlet - Looking for the initial context
Context initialContext = null;
try
{
initialContext = new InitialContext();
}
catch (Exception e)
{
out.println("RegionServlet - Cannot get initial context for JNDI: "
+e+"
br
");
¨
§
return ;
}
out.println("RegionServlet - Looking up bean's home interface
RegionHome home;
try
{
home = (RegionHome)PortableRemoteObject.narrow(
initialContext.lookup("java:comp/env/ejb/RegionHome"),
RegionHome.class);
}
catch (Exception e)
{
out.println("RegionServlet - Cannot lookup home interface: "
+e+"
br
");
¨
§
return ;
}
out.println("RegionServlet - Creating a new bean instance
Region bean;
try
{
bean = home.create();
}
catch (Exception e)
{
sp.printHTML("RegionServlet - Error while creating new bean instance: "
+e+"
br
");
¨
§
return ;
}
... here you can call any method defined in the bean
remote interface (example: bean.doSomething(...);) ...
out.println("
out.println("
}
}
html
");
¨
§
body
");
¨
§
/body
\n");
¨
§
/html
\n");
¨
§
Chapter 8. Accessing Beans From a Servlet
");
§
br
")
¨
§
br
")
¨
§
br
")
¨
§
Need help?
Do you have a question about the APPLICATION SERVER - JONAS and is the answer not in the manual?
Questions and answers