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

📄 listaccounts.txt

📁 噶额外噶外骨骼感广泛高热感 就 啊啊
💻 TXT
字号:

import javax.servlet.http.HttpSession;

import itso.bank.model.Customer;
import itso.bank.model.Account;
import itso.bank.facade.Banking;


	public void doGet(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException {
		performTask(req, resp);
	}

	public void doPost(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException {
		performTask(req, resp);
	}

	public void performTask(HttpServletRequest req,	HttpServletResponse resp) 
		throws ServletException, IOException {
		try {
			// Parameters
			// Get input parameter and keep it on the HTTP session
			String customerNumber = req.getParameter("customerNumber");
			HttpSession session = req.getSession();

			if (customerNumber == null)
				customerNumber = (String) session.getAttribute("customerNumber");
			else
				session.setAttribute("customerNumber", customerNumber);

			// Control logic
			// Create the new banking fa鏰de
			Banking banking = new Banking();
	
			// Retrieve customer and related accounts
			Customer customer = banking.getCustomer(customerNumber);
			Account[] accounts = banking.getAccounts(customerNumber);

			// Response
			// Set the request attributes for future rendering
			req.setAttribute("customer", customer);
			req.setAttribute("accounts", accounts);

			// Call the presentation renderer
			getServletContext().getRequestDispatcher("listAccounts.jsp").forward(req, resp);
		
		} catch (Exception e) {
			req.setAttribute("message", e.getMessage());
			req.setAttribute("forward", "index.html");
			getServletContext().getRequestDispatcher("showException.jsp").forward(req, resp);
		}
	}

⌨️ 快捷键说明

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