Chapter 7: Building Shopping Cart Applications


“There are no such things as applied sciences, only applications of science.”

—Louis Pasteur (1822–1895)

Overview

Managing major e-businesses these days requires significant development of Web resources, particularly if you want to let your customers purchase products and services online. Building the Web site you need to accomplish your business goals is not a simple undertaking. Available Java technologies (JavaServer Pages, servlets, and JavaBeans™) offer different advantages, and combining them to achieve the best results is usually necessary. Although you can build a simple shopping cart using JSP alone, significant business applications require the complementary strengths of all three technologies. Let’s see how to combine them to best effect.

For example, JSP offers a 100 percent pure Java alternative to Microsoft’s proprietary Active Server Pages (ASP). JSP technology extends Java servlet technology, and, in fact, the JSP framework translates JSP into servlets at runtime. Servlets are popular because they supply architectural and performance advantages over Common Gateway Interface (CGI) scripts. Servlets can also generate dynamic Web pages by mixing static HTML with content supplied by database queries or business services. JavaServer Pages invert this approach by imbedding Java code in HTML. This ability to insert Java code into HTML pages adds flexibility to servlet-based Web architectures.

To generate HTML, servlets must supply formatted strings to println() calls. This technique clogs Java code with line after line of hard-to-comprehend HTML. Furthermore, when servlets generate HTML, Web page design requires programmers. JavaServer Pages pull HTML out of Java code and create a role for HTML designers. Site development can proceed along parallel tracks (Java design and HTML design), thereby delivering a Web site faster. JavaServer Pages also encourage loose coupling between business logic components and presentation components, thereby making reuse of both more likely. The shopping cart application discussed in this chapter examines the role of JSP in Web architectures and offers a practical example of how to get the most out of your e-business applications.




Electronic Commerce (Networking Serie 2003)
Electronic Commerce (Charles River Media Networking/Security)
ISBN: 1584500646
EAN: 2147483647
Year: 2004
Pages: 260
Authors: Pete Loshin

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net