Rendering HTML with a servlet
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession(false);
(BankAccount)session.getValue("home.banking.account");
double balance = account.getBalance();
java.text.NumberFormat number =
java.text.NumberFormat.getCurrencyInstance(Locale.UK);
String formattedBalance = number.format(balance);
- Following a successful look up, this servlet pulls the account object from the session, retrieves its balance and formats it using a currency object