caucho
 


<web-app>
  <classpath id='/usr/local/weblogic/myserver/clientclasses'/>
  <classpath id='/usr/local/weblogic/lib/weblogicaux.jar'/>
  <classpath id='/usr/local/weblogic/classes'/>

  <jndi-link>
    <jndi-name>java:comp/env/ejb/traderHome</jndi-name>
    <jndi-factory>weblogic.jndi.WLInitialContextFactory</jndi-factory>
    <init-param java.naming.provider.url="t3://localhost:7001"/>
    <jndi-lookup>statelessSession.TraderHome</jndi-lookup>
  </jndi-link>
</web-app>

<%@ page import='javax.naming.*' %>
<%@ page import='examples.ejb.basic.statelessSession.*' %>
<%@ page import='javax.rmi.*' %>
<%
Context ic = new InitialContext();

Object homeObj = ic.lookup("java:comp/env/ejb/traderHome");
TraderHome home;
home = (TraderHome) PortableRemoteObject.narrow(homeObj, TraderHome.class);

Trader trader;
trader = (Trader) PortableRemoteObject.narrow(home.create(), Trader.class);

String stock = request.getParameter("stock");
int shares = Integer.parseInt(request.getParameter("shares"));

TradeResult result = trader.buy(stock, shares);
%>
Bought <%= result.getNumberTraded() %>
       <%= result.getStockSymbol() %><br>
<%
trader.remove();
%>


Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.