transferbean.java
来自「本教程介绍j2ee企业开发方面的知识」· Java 代码 · 共 71 行
JAVA
71 行
/* * * Copyright 2001 Sun Microsystems, Inc. All Rights Reserved. * * This software is the proprietary information of Sun Microsystems, Inc. * Use is subject to license terms. * */ package com.sun.ebank.web;import com.sun.ebank.web.Currency;import com.sun.ebank.web.BeanManager;import com.sun.ebank.util.*;import com.sun.ebank.ejb.tx.TxController;import com.sun.ebank.ejb.exception.*;import java.util.*;import java.rmi.RemoteException;public class TransferBean { private BeanManager beanManager; private double transferAmount; private String fromAccountId, toAccountId; public TransferBean () { beanManager = null; transferAmount = 0.0; fromAccountId = ""; toAccountId = ""; } public void populate() { TxController txCtl = beanManager.getTxController(); try { txCtl.transferFunds(transferAmount, "Transfer", fromAccountId, toAccountId); } catch (RemoteException e) { } catch (IllegalArgumentException e) { } catch (AccountNotFoundException e) { } catch (InsufficientFundsException e) { } catch (InsufficientCreditException e) { } } public double getTransferAmount() { return transferAmount; } public String getFromAccountId() { return fromAccountId; } public String getToAccountId() { return toAccountId; } public void setBeanManager(BeanManager beanManager) { this.beanManager = beanManager; } public void setTransferAmount(double transferAmount) { this.transferAmount = transferAmount; Debug.print("Setting transfer amount to: " + transferAmount); } public void setFromAccountId(String fromAccountId) { this.fromAccountId = fromAccountId; Debug.print("Setting from account id to: " + fromAccountId); } public void setToAccountId(String toAccountId) { this.toAccountId = toAccountId; Debug.print("Setting to account id to: " + toAccountId); } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?