CSCI 6962: Server-side Design and Programming Support Classes and Shopping Carts.

Slides:



Advertisements
Similar presentations
CSCI 6962: Server-side Design and Programming Input Validation and Error Handling.
Advertisements

Internet Technologies 1 Master of Information System Management Java Server Faces Model/View/Controller Design Pattern for Web Development Slides.
JavaServer Faces. Objectives To implement dynamic web pages with JavaServer Faces (JSF) technology To learn the syntactical elements of JavaServer Faces.
11 3 / 12 CHAPTER Databases MIS105 Lec14 Irfan Ahmed Ilyas.
Design and Planning Presenter: Mike Team Members: Casey Kaushik Danny.
Program design example Task: Develop an algorithm expressed in pseudocode for a specified problem specified problem.
XP Tutorial 9 New Perspectives on JavaScript, Comprehensive1 Working with Cookies Managing Data in a Web Site Using JavaScript Cookies.
Object-Oriented Analysis and Design
ASP.NET Programming with C# and SQL Server First Edition
Factory Design Pattern, cont’d COMP 401 Fall 2014 Lecture 13 10/2/2014.
Training Guide. The Punch Out Catalog System The Punch Out shopping catalog for Office Depot takes the user directly into the vendor’s website and online.
Chapter 12 Information Systems. 2 Chapter Goals Define the role of general information systems Explain how spreadsheets are organized Create spreadsheets.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Spreadsheet in excel Spreadsheet in Excel Uses of spreadsheet
CSCI 6962: Server-side Design and Programming History and Background.
CST JavaScript Validating Form Data with JavaScript.
Address Book in JAVA By What is Address Book Address Book is book or database used for storing entries called contacts Each contact.
Chapter 12 Information Systems. 2 Chapter Goals Define the role of general information systems Explain how spreadsheets are organized Create spreadsheets.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
Introduction to Object-oriented Programming CSIS 3701: Advanced Object Oriented Programming.
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
CSCI 6962: Server-side Design and Programming Introduction to AJAX.
Chapter 33 CGI Technology for Dynamic Web Documents There are two alternative forms of retrieving web documents. Instead of retrieving static HTML documents,
CSCI 6962: Server-side Design and Programming JDBC Database Programming.
Server-side Scripting Powering the webs favourite services.
CSCI 6962: Server-side Design and Programming Validation Tools in Java Server Faces.
Online Shopping JavaScript project for CS 175 JavaScript for Web Development, Spring 2009 By Sita Akella.
Java Class Syntax CSIS 3701: Advanced Object Oriented Programming.
Automatic Generation of Web Interfaces From User Interaction Diagrams Filipe Bianchi Damiani Patrícia Vilain Federal University of Santa Catarina (UFSC)
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Using JavaBeans Components in JSP Documents. Contents 1. Why using beans? 2. What are beans? 3. Using Beans: Basic Tasks 4. Sharing Beans 5. Practice.
Jonathan Westlake, ed: Nic Shulver JSP, Structure and JavaBeans JSP models Assignment context “Register as a member of the site/show member details/update.
10 Adding Interactivity to a Web Site Section 10.1 Define scripting Summarize interactivity design guidelines Identify scripting languages Compare common.
Design Patterns Phil Smith 28 th November Design Patterns There are many ways to produce content via Servlets and JSPs Understanding the good, the.
SHOPPING CARTS CHAPTER 19. E-COMMERCE Typically, an e-commerce site will have public pages and admin pages.
CSCI 6962: Server-side Design and Programming Introduction to Java Server Faces.
Chapter 8 Script-free pages. Problem with scripting in JSP When you use scripting (declaration, scriplet, expressions) in your JSP, you actually put Java.
CS453: State in Web Applications (Part 1) State in General Sessions (esp. in PHP) Prof. Tom Horton.
CSCI 6962: Server-side Design and Programming Java Server Faces Components and Tags.
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
1 OPOL Training (OrderPro Online) Prepared by Christina Van Metre Independent Educational Consultant CTO, Business Development Team © Training Version.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Tutorial 8 Programming with ActionScript 3.0. XP Objectives Review the basics of ActionScript programming Compare ActionScript 2.0 and ActionScript 3.0.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
Java Event Handling CSIS 3701: Advanced Object Oriented Programming.
Near East University Department of Computer Engineering E-COMMERCE FOR LAPTOPS SELLING COMPANY Abdul Halim Abu Kuwaik
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
CSC1401 Classes - 2. Learning Goals Computing concepts Adding a method To show the pictures in the slide show Creating accessors and modifiers That protect.
For internal use only / © Siemens Industry Inc. 2010For internal use only / © Siemens Industry Inc Siemens Industry, Inc. Industry Mall Available.
CSCI 6962: Server-side Design and Programming Java Server Faces Scoping and Session Handling.
1 CSC/ECE 517 Fall 2010 Lec. 3 Overview of Eclipse Lectures Lecture 2 “Lecture 0” Lecture 3 1.Overview 2.Installing and Running 3.Building and Running.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 41 JavaServer Face.
CSCI 6962: Server-side Design and Programming JSF DataTables and Shopping Carts.
1 of 16 Microsoft ® Business Solutions–Navision ® Development I – C/SIDE Introduction.
CSCI 6962: Server-side Design and Programming Facelets and User Interface Design.
CreatingClasses-SlideShow-part31 Creating Classes part 3 Barb Ericson Georgia Institute of Technology Dec 2009.
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
 Shopping Basket  Stages to maintain shopping basket in framework  Viewing Shopping Basket.
Creating Databases for Web Applications 3-Tier. Design vs Function vs Content. More SQL. More php. Homework: work on final projects.
More about Java Classes Writing your own Java Classes More about constructors and creating objects.
Cooper Interaction Design Process: Iteration Dr. Cindy Corritore Creighton University ITM 734 Fall 2005.
CSCI 6962: Server-side Design and Programming Shopping Carts and Databases.
GKWB929E9E Gadget /images/inventory/3.png There is a web.
A Presentation Presentation On JSP On JSP & Online Shopping Cart Online Shopping Cart.
CSCI 6962: Server-side Desig n and Programming ASP Server Controls.
Chapter 3: Using Methods, Classes, and Objects
Presentation transcript:

CSCI 6962: Server-side Design and Programming Support Classes and Shopping Carts

Model-View-Control Architecture Model = software classes that store/manipulate information gathered by application –Usually separate from beans, which interact with them –Often interact with databases request JSF page Classes that model business process Database Managed bean

Business Model Objects Key idea: Methods in model objects should implement business model –Methods to validate values (number in stock, etc.) –Methods to perform computations (prices, taxes, etc.) –Methods to store/retrieve information in database Often created by other developers as part of overall information system

Model-View-Control Architecture Model: Support objects that implement business logic View: JSF pages that define how information presented to user Control: Managed beans that act as intermediary between JSF pages and support classes, determine next pages, etc. 4

Model Class Example Widget model class for widget ordering (designed for shopping cart) –Name, ID, price of specific widget added to order –Quantity of that widget in this order –Constructor takes ID and retrieves price, name from database –Provides array of all widget IDs for selection (retrieved from database) 5

Widget Support Class 6 Member variables Getters for data that does not change (required if hook to JSF elements) Getters and setters for data that might change

Widget Support Class 7 Given ID, constructor “looks up” corresponding widget name and price (would be done with database access) Returns list of all widget IDs to construct menu of choices for purchase (would also be done in database)

Shopping Carts Displays list of items added to cart –Name, price, quantity, other relevant information Usually not product ID –May display other information Total order price, etc. User can usually modify cart contents –Remove items –Update quantities –…–…

Shopping Carts Usually implemented as list of items –List = Vector type in Java –Has methods to add new element to end, get i th element, and remove i th element Each list element is business model object –Has fields for all relevant data about item purchased –May have way to set quantity purchased Not all models have quantity (course registration, etc.)

Widget Cart in JSF 10

Implementing Widget Selection Simple approach: Generate array of SelectItem elements in bean –Created from static Widget method 11 Iterate through array, constructing Widget for each to get name, price Construct selectItem for each with ID as value and combination of name and price as label

Implementing Widget Selection Displayed as list of items using <f:selectItems Linked to itemPurchased in cart bean Validation to insure something selected… 12

Implementing the Cart Contains Vector (linked list) of items When item purchased, new Widget object constructed from ID and added to that list 13

Displaying the Cart Method returns list of items as array –Works best with JSF page 14

Displaying the Cart JSF page loops through array –Each iteration accesses different Widget object Can the access fields of that Widget object for display –Syntax: ${widgetobject.fieldname} –Automatically calls correpsonding getFieldname method in support class 15

Updating the Cart Bean provides methods for Removing widget with given ID Updating quantity of widget with given ID 16

Updating the Cart Requires methods to look up item to modify by ID –Passed from JSF page 17

Displaying Buttons in Cart Page Each table row contains entire form for remove, update quantity buttons Passes widget ID as parameter (created from widget object in loop) 18

Updating Quantity Display current quantity in inputText element –Use validation to make sure user changes legally Call update method with ID, new quantity value 19