⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 listaccountsaction.txt

📁 噶额外噶外骨骼感广泛高热感 就 啊啊
💻 TXT
字号:
import javax.servlet.http.HttpSession;
import itso.bank.exception.*;
import itso.bank.facade.*;
import itso.bank.model.*;
import java.util.*;


	public ActionForward execute(
		ActionMapping mapping,
		ActionForm form,
		HttpServletRequest request,
		HttpServletResponse response)
		throws Exception {

		ActionErrors errors = new ActionErrors();
		ActionForward forward = new ActionForward();
		// return value
		CustomerInfoForm customerInfoForm = (CustomerInfoForm) form;

		try {

			// Get input parameter customerNumber and keep it on the HTTP session
			String customerNumber = customerInfoForm.getCustomerNumber();
			HttpSession session = request.getSession();
			if (customerNumber == null)
				customerNumber = (String) session.getAttribute("customerNumber");
			else
				session.setAttribute("customerNumber", customerNumber);
			session.removeAttribute("accountNumber");

			// Create the new banking fa鏰de, get Customer and Accounts
			Banking banking = new Banking();
			Customer customer = banking.getCustomer(customerNumber);
			Account[] accounts = banking.getAccounts(customerNumber);

			// Populate the CustomerInfo Form Bean for display
			customerInfoForm.setCustomerName( customer.getFirstName()+" "+customer.getLastName());
			String[] accountNumbers = new String[accounts.length];
			for (int i=0; i<accounts.length; i++)
				accountNumbers[i] = accounts[i].getId();
			customerInfoForm.setAccountNumbers( accountNumbers ); 
			// set first account number to check the first radio button
			// customerInfoForm.setAccountNumber( accountNumbers[0] );

			// Store the bean in the correct scope
			if ("request".equals(mapping.getScope()))
				request.setAttribute(mapping.getName(), customerInfoForm);
			else
				session.setAttribute(mapping.getName(), customerInfoForm);

		} catch (CustomerDoesNotExistException e) {
			errors.add(ActionErrors.GLOBAL_ERROR,
				new ActionError("error.customerDoesNotExistException"));

		} catch (Exception e) {
			errors.add(ActionErrors.GLOBAL_ERROR,
				new ActionError("error.genericException"));
		}

		if (!errors.empty()) {
			saveErrors(request, errors);
			forward = mapping.getInputForward();
		} else {
			forward = mapping.findForward("success");
		}

		// Finish with
		return (forward);
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -