O'Reilly logo

MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL by James Turner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Completing the Order

With the beans in place to record orders and authorize credit cards, you can write the JSP to run the credit card and complete the order (see Listing 13.9).

Listing 13.9. authorizePurchase.jsp
 <%@ include file="/jsp/cust/AutoLogin.jsp" %> <%@ page import="com.bfg.product.Product" %> <%@ page import="com.bfg.product.Order" %> <%@ page import="java.util.Iterator" %> <%@ page import="com.bfg.cart.CartItem" %> <jsp:useBean id="orderaddr" class="com.bfg.customer.Address" scope="session"/> <jsp:useBean id="ordercredit" class="com.bfg.customer.CreditCard" scope="session"/> <jsp:useBean id="cart" class="com.bfg.cart.Cart" scope="session"/> <jsp:useBean id="customer" class="com.bfg.customer.Customer" scope="session"/> <% if (!cart.authorizeCharge(ordercredit)) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required