<%@ 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();
%>
|