文档介绍:×÷Õߣºdiego lynn ÈÕÆÚ£º2001-3-15 15:05:59
<%= pagetitle %>
<%@ page import=" .*, .*, , , .*, .* "%> <%! String pagetitle = "JSP example using EJBean-managed persistence"; String url = "t3://localhost:7001"; String accountId = "10020"; // Declaring a Java class public Context getInitialContext() throws Exception { Properties p = new Properties(); (, ""); (, url); return new InitialContext(p); } String getStackTraceAsString(Exception e) { // Dump the stack trace to a buffered stream, then send it's contents // to the JSPWriter. ByteArrayOutputStream ostr = new ByteArrayOutputStream(); (new PrintWriter(ostr)); return(()); } %> <% double amount = 100; double balance = 3000; AccountPK accountKey = new AccountPK(); = accountId; try { // Contact the AccountBean container (the "AccountHome") through JNDI. Context ctx = getInitialContext(); AccountHome home = (AccountHome) (""); %>
Looking up account <%= accountId %> ... <% Account ac = null; try { ac = (Account) (accountKey); } catch (Exception ee) { ("
Did not find "+ accountId); } if (ac == null) { ("
Account