1 Architecting Web Applications using JSF & Struts ASSIGNMENT GUIDELINE.

Slides:



Advertisements
Similar presentations
Microsoft Expression Web-Illustrated Unit J: Creating Forms.
Advertisements

MS-Access XP Lesson 1. Introduction to MS-Access Database Management System Software (DBMS) Store data in databases Database is a collection of table.
Library Online Catalog Tutorial Pentagon Library Last Updated March 2008.
UIC Data Conversion and Submission via CDX Node Client UIC Database V2 6/16/
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Internet Technologies 1 Master of Information System Management Java Server Faces Model/View/Controller Design Pattern for Web Development Slides.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
DT228/3 Web Development Databases. Database Almost all web application on the net access a database e.g. shopping sites, message boards, search engines.
Performed by:Gidi Getter Svetlana Klinovsky Supervised by:Viktor Kulikov 08/03/2009.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
8/6/2015Auto Attendants 1 Smarter Communications.
Create a New Application and Project Open the Create Application dialog. Enter the application name of your choice and the directory. Select No Template.
Figure 1. Hit analysis in 2002 of database-driven web applications Hits by Category in 2002 N = 73,873 Results Reporting 27% GME 26% Research 20% Bed Availability.
Java Enterprise Edition Java Web Development Structure of a web project Introduction to Web Applications The first project Introduction to Java Web Development.
CST JavaScript Validating Form Data with JavaScript.
DATA, DATABASES, AND QUERIES Managing Data in Relational Databases CS1100Microsoft Access - Introduction1 Created By Martin Schedlbauer
CIS 270—App Dev II Big Java Chapter 22 Relational Databases.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
September 5, 2015 Office Setup. Lesson Overview: Office Setup  In this lesson we will cover:  Adding new offices to COM  Individual office setup 
CSCI 6962: Server-side Design and Programming
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Role of Account Management at ERCOT Market Participant Identity Management Overview (MPIM)
VASP PREPAYMENT SYSTEM Training Module for CLIENTS.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
Author: DoanNX Version 2.0/Time: 30’. The ways to solve it There are 2 main ways:  Client-side: Using JavaScript (now one very good option is JQuery).
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
CSCI 6962: Server-side Design and Programming JDBC Database Programming.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
AQS Web Quick Reference Guide Changing Raw Data Values Using Maintenance 1. From Main Menu, click Maintenance, Sample Values, Raw Data 2. Enter monitor.
CSCI 6962: Server-side Design and Programming Support Classes and Shopping Carts.
Creating a Web Site to Gather Data and Conduct Research.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
CSCI 6962: Server-side Design and Programming Introduction to Java Server Faces.
Java Server Pages A JSP page is a text-based document that contains two types of text: static template data, which can be expressed in any text-based format,
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 6 1 Microsoft Office FrontPage 2003 Tutorial 6 – Publishing a Web Site.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 30 – Bookstore Application: Client Tier Examining.
Struts J2EE web application framework “ Model 2 ” Model View Controller Controller Servlet Key features XML metadata Struts taglib Simplified form validation.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
System Initialization 1)User starts application. 2)Client loads settings. 3)Client loads contact address book. 4)Client displays contact list. 5)Client.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
How to Build a Struts Application with JBuilder 9.
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
DT228/3 Web Development Databases. Querying a database: Partial info Search engines, on-line catalogues often need to allow user to search a database.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 41 JavaServer Face.
Controlling Web Site Access Using Logins CS 320. Basic Approach HTML form a php page that collects the username and password  Sends them to second PHP.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Bookstore Application: Middle Tier Introducing Code-Behind Files, Session State.
Table of Contents TopicSlide Administrator Login 2 Administrator Navigations 3 Managing AlternativeDr.com Blogs 4 Managing Dr. Lloyd May Blogs 5 Managing.
PHP getting data from a MySQL database. Replacing XML as data source with MySQL Previously we obtained the data about the training session from an XML.
>> PHP: Insert Query & Form Processing. Insert Query Step 1: Define Form Variables Step 2: Make DB Connection Step 3: Error Handling Step 4: Define the.
CSCI 6962: Server-side Design and Programming JSF DataTables and Shopping Carts.
1 Web Programming with Servlets & JSP ASSIGNMENT GUIDELINE.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
13 Copyright © 2004, Oracle. All rights reserved. Adding Validation and Error Handling.
11 Copyright © 2004, Oracle. All rights reserved. Customizing Actions.
Struts Framework Day-2 Ashok Chakravarti. DataSource Usage Sample Struts-config.xml …
Chapter 12© copyright Janson Industries Java Server Faces ▮ Explain the JSF framework ▮ SDO (service data objects) ▮ Facelets ▮ Pagecode classes.
1 CS 3870/CS 5870: Note07 Prog 4. Master Pages Creating a master page based on another master page MainMasterPage –For all Progs and Tests Prog4MasterPage.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
Navigation: If the tutorial opens up in your web browser, simply click your mouse to advance to the next slide. Use the “Backspace”
Programming with Microsoft Visual Basic 2012 Chapter 14: Access Databases and SQL.
Unit 9 Seminar. Starting Reporting Services Reporting Service Started.
Chapter 5 Validating Form Data with JavaScript
IBM SCPM Basic Navigation
Presentation transcript:

1 Architecting Web Applications using JSF & Struts ASSIGNMENT GUIDELINE

Objectives  Assignment Guideline 1  Assignment Guideline 2  Assignment Guideline 3  Assignment Guideline 4  Assignment Guideline 5  Assignment Guideline 6 2

Assignment Guideline 1 3 Application’s Name View: -Shows all products in DB -Allows to add Product to Cart Supported class: a Cart’s Item Model: process and store Cart Controller: dispatcher View Cart with add more Products and Order function Transfer store current cart request to order object in DB Transfer OrderID request to show order object from DB View order object details from DB

Assignment Guideline 1 (cont) 4

5  index.jsp (input View)  “Add to Cart”: “add” action with form  “View Cart”: “view” action  “Show Order”: “show” action  Load data from DB and present as the right picture.  cartObj.java (supported Object)  Properties: productID, productName, price, amount  Constructor with 3 parameters except amount (default with 1)  Define method equals to compare input Object with cartObj

Assignment Guideline 1 (cont) 6  cartBean.java (Model)  Properties: customerID, customerName, contents (Vector data type – use store added Products)  No parameter constructor: initial Vector and generate random customerID in [0, 999]  The properties’ getter and setter  The addProduct method: add product Item to cart (Notes: if product is existed, it’s amount is increased automatically)  The removeProduct method: remove product Item from cart (Hint: should you productID as input parameter)  The storeCart method: create order object in DB from the Cart  Create a new row in Order table (The customerID is a orderID field)  Create new rows in Order details table relating with Cart’s data  Update the Total field in Order table

Assignment Guideline 1 (cont) 7  view.jsp (display View)  “Remove”: “remove” action  “Add more Product”: “more” action  “Order Products”: “order” action  Present current Cart’s information as the right picture.  Hint: the “Remove” link should use a URL-Rewriting technology to send input parameter to server.

Assignment Guideline 1 (cont) 8  order.jsp (input View)  “Order”: “store” action with form  “Add more Product”: “more” action  “View cart”: “view” action  Allow to input Customer Name  viewOrder.jsp (display View)  Display date from DB as the template  “New shopping”: “more” action  “Show order”: “show” action  show.jsp (input View)  “Main page”: “more” action  “View Order Details”: “detail” action in form.

Assignment Guideline 1 (cont) 9  ControllerServlet.java (Controller)  Initial HttpSession and get “cart” Object in session  Get actions from client and implement actions  “add”: add product Item to cart and forward index.jsp page  “view”: forward view.jsp page  “more”: forward index.jsp page  “order”: forward order.jsp page  “remove”: remove product Item from cart and forward view.jsp page  “show”: forward show.jsp page  “detail”: forward viewOrder.jsp page  “store”: set CustomerName value to cart, store cart to DB, forward viewOrder.jsp, and remove cart from session  Update “cart” state in session excepting show, store, and detail action  Execute and test the application.

Assignment Guideline 2 10 Application’s Name Shows all books in DB. Link to searchBook.jsp Form Bean Form View: input control to get information to search Struts Configuration File Action class Represent the Searching result

Assignment Guideline 2 (cont) 11

Assignment Guideline 2 (cont) 12  index.jsp  “Search Book”: forward searchBook.jsp (searchBook.do)  searchBook.jsp  Input text “name”  Radio control “type”  Submit control  Form with “displaySearch” action  FormBean: SearchBookForm.java  Properties: name, type  Action class: SearchAction  Set formBean’s properties to request’s Attribute  Forward “success”

Assignment Guideline 2 (cont) 13  display.jsp (input View)  “Return main page”: action “mainPage.do”  Configure struts-config.xml  Define form-bean “SearchBookForm” mapping SearchBookForm.class  Mapping Action “displaySearch” with SearchAction  Define forward “searchBook” and “mainPage” in global-forwards

Assignment Guideline 3 14 Application’s Name Get Book Information to search in DB Process download List Searching Result and Download button on each result Struts Configuration File inside WEB-INF directory Inputting reader’s information form Inform success message after storing book information which is inputted by readers Inform error by stored occurring Action Form Action

Assignment Guideline 3 (cont) 15

Assignment Guideline 3 (cont) 16  index.jsp  “Search”: form with “search” action  Book Name: input text “name”  FormBean: SearchActionForm.java  Properties: name  Action class: SearchAction  Find on DB  Set “name” attribute to request  If found, Forward “found”  Otherwise, forward “notfound”

Assignment Guideline 3 (cont) 17  found.jsp  List Searching Result  “Download File”: form with “download” action  Book Name: hidden input text “fileName”  “Return main page”: “main.do”  FormBean: DownloadActionForm.java  Properties: fileName  Action class: DownloadAction  Set “fileName” attribute to request  Forward “success”

Assignment Guideline 3 (cont) 18  download.jsp  Download file from Server  Hint: DB stores relative path  Tip code

Assignment Guideline 3 (cont) 19  notfound.jsp  “Send Information”: form with “store” action  input texts with “title”, “author”, “publication”, “subject”  Select control “rating” ([1, 5])  “Return main page”: “main.do”  FormBean: StoreActionForm.java  Properties:same above controls name  Action class: StoreAction  Insert information to DB  If success, forward “success”  Otherwise, forward “fail”

Assignment Guideline 3 (cont) 20  success.jsp and error.page  “Return main page”: “main.do”

Assignment Guideline 4 21 Application’s Name Struts-config.xml, validation.xml inside Form View: -Shows all products in DB -Allows to add Product to Cart Supported class: a Cart’s Item Model: process and store Cart Action with DynaActionForm View Cart with add more Products and Order function Transfer store current cart request to order object in DB Transfer OrderID request to show order object from DB View order object details from DB

Assignment Guideline 4 (cont) 22

Assignment Guideline 4 (cont) 23  index.jsp (input View)  “Add to Cart”: “add” action with form  “View Cart”: “view” action  “Show Order”: “show” action  Load data from DB into hidden text “productID”, “productName”, “unit”, “price” and present as the right picture.  cartObj.java (supported Object)  Properties: productID, productName, productUnit, price, amount  Constructor with 4 parameters except amount (default with 1)  Define method equals to compare input Object with cartObj

Assignment Guideline 4 (cont) 24  cartBean.java (Model)  Properties: customerID, contents (Vector data type – use store added Products)  No parameter constructor: initial Vector and generate random customerID in [0, 99999]  The properties’ getter and setter  The addProduct method: add product Item to cart (Notes: if product is existed, it’s amount is increased automatically)  The removeProduct method: remove product Item from cart (Hint: should you productID as input parameter)  The storeCart method: create order object in DB from the Cart  Create a new row in Order table (The customerID is a orderID field)  Create new rows in Order details table relating with Cart’s data  Update the GiftTotal, Extra, OrderTotal field in Order table

Assignment Guideline 4 (cont) 25  FormBean: declare DynaActionForm with properties  Properties: productID, productName, unit, price  Action class: AddAction  Get “cart” attribute from Session (if null, create new)  Create cartObj with retrieved values from FormBean  Call addProduct into cart  Update “cart” attribute into Session  Forward “success”

Assignment Guideline 4 (cont) 26  view.jsp (display View)  “Remove”: “remove” action  “Add more Product”: “more” action  “Order Products”: “order” action  Present current Cart’s information as the right picture.  Hidden text “productID” in “remove” form  FormBean: DynaActionForm with properties productID  Action: RemoveAction  Get “cart” attribute from session  Call remove(productID) with cart  Update “cart” attribute into session  Forward “success”

Assignment Guideline 4 (cont) 27  order.jsp (input View)  “Order”: “store” action with form  “Add more Product”: “more” action  “View cart”: “view” action  Input text “customerName”,“customer ”, “customerAddress”, “creditCard”  Select control “nDate” [1, 4]  FormBean: DynaValidatorForm with above properties.  Action: StoreAction  Get “cart” attribute from Session  Call store() with above properties  Set “custID” attribute with customerID into request  Remove “cart” attribute from Session  Forward “success”

Assignment Guideline 4 (cont) 28  Define Validation Rule in orderForm properties in validation.xml  customerName: required  customerID: required,  customerAddress: required, minlength [10]  creditCard: required, creditCard

Assignment Guideline 4 (cont) 29  viewOrder.jsp (display View)  Display data from DB as the template  “New shopping”: “more” action  “Show order”: “show” action  show.jsp (input View)  “Main page”: “more” action  “View Order Details”: “detail” action in form.  Input text “custID”  FormBean: DynaActionForm with “custID” property  Action: ShowAction  Set “custID” attribute into request  Send forward “success”

Assignment Guideline 4 (cont) 30  Configure struts-config.xml with forward action show, order, more, and view  Run and Test program  Demo of DynaActionForm which are not created ActionForm class

Assignment Guideline 5 31 Application’s Name Error messages Form Bean JSF managed Bean: car Information JSF Configuration File Input rental Information Confirm Information Faces root page List car pages Supported class for Car JSF managed Bean: car Information Collection JSF managed Bean: rental Information Supported class for Rental

Assignment Guideline 5 (cont) 32

Assignment Guideline 5 (cont) 33  index.jsp  Forward to rental.jsp  rental.jsp  JSF Form shows car Information  Get car information from CarBean  Transfer param carID on Rental link  Hint  Click Rental link, the rentalForm.jsp is show  This form should be used the dataTable component of JSF

Assignment Guideline 5 (cont) 34  JSF managed bean: carBean  Car’s information: id, name, seatAmount, status  Supported Car’s information class  Load car’s information to collection data to view on dataTable  To transfer the parameter from the rental.jsp to rentalForm.jsp, actually the parameter is transferred to bean (Rental Bean)  The code hint support to transfer the parameter is JSF supported through faces- config.xml as

Assignment Guideline 5 (cont) 35  rentalForm.jsp  JSF Form with JSF controls  Confirm to show information in the confirm.jsp  Cancel to go the rental.jsp  Hint: in this form, the hidden form field is applied  JSF managed bean: rentalBean  Information: custName, custAddress, custYear, custPhone, rentalType, carID  Checking constraint with Name (at least 5 chars), Address (at least 10 chars), Phone (number and at least 8 digits)  Process data Temp in session  Process storing data to DB in confirm.jsp and set status to not available in Car table  rentalDB is a supported class  Support store rental information to session

Assignment Guideline 5 (cont) 36  fail.jsp  Show message as figure  confirm.jsp  JSF Form shows rental Information  Submit to store all information into DB  Go Back to rentalForm.jsp/ rental.jsp

Assignment Guideline 6 37

Assignment Guideline 6 (cont) 38

Assignment Guideline 6 (cont)

 Click View Schedule button

Assignment Guideline 6 (cont)  Click Accept button

Assignment Guideline 6 (cont) 43  Design the application forms as Label (Basic) TextField (Basic) with required attribute true Button (Basic), the reset button is create with reset attribute set true (checked) Message (Basic), constraint order with username and password

Assignment Guideline 6 (cont) 44  Design the application forms as Label (Basic) Static text bound to username of Login Bean Table (Basic) Calendar (Basic) Message (Basic) Button (Basic) Text Field (Basic)

Assignment Guideline 6 (cont) The control same as the previous slide

Assignment Guideline 6 (cont)  Design the application forms as HyperLink (Basic) with url attribute set to login.jsp Label (Basic)  Navigation page as

Assignment Guideline 6 (cont)  Design the DB as

Assignment Guideline 6 (cont)  Generate the LoginBean with session scope as public class LoginBean extends AbstractSessionBean { private String username; private boolean roles;//true is manage, false is employee private String tmpUser=""; Building the get/set method for properties }

Assignment Guideline 6 (cont)  In login.jsp page, generate the action for login button as public String btLogin_action () { Connect DB String strSQL = "Select * from JSF_Account where username=? and password=?"; stm = con.prepareStatement (strSQL); stm.setString (1, uname); stm.setString (2, pword); ResultSet rs = stm.executeQuery (); if(rs.next ()){ status = "manager"; LoginBean tmp = getLoginBean (); tmp.setUsername (rs.getString (1)); boolean roles = rs.getBoolean (3); tmp.setRoles (roles); if(!roles){status = "employee";} }

Assignment Guideline 6 (cont)  Create DataSource in Netbeans to connect DB  On tab Runtime on NetBeans, choose Databases, choose Drivers, click “New Driver…” Click Add button to choose the lib jar file Click Find Button or choose the correspondent Drivers Naming the Name of Driver Click Ok Button the New Drivers is add Drivers Item

Assignment Guideline 6 (cont)  Create DataSource in Netbeans to connect DB (cont)  Right click on the corresponding Driver, click “Connect Using …” Typing connection String to connect DB Typing username and password that connect DB Click Ok button the Datasource is automatically created

Assignment Guideline 6 (cont)  Connect DataSource to DB  Right click the corresponding DataSource, Click Connect, Fill username and password  Notes: if the Datasource is connected the above step omited  Connect table control with Datasource  Choose the corresponding connected Datasource, choose the corresponding table, then drag and drop to the title of table control  The DataProvider and RowSet is automatically is created. Notes: If DataProvider is existed, the Netbeans show the Dialog presented to choose one

Assignment Guideline 6 (cont)  On the refresh page or isPostBack properties of DotNet, the event is activated as prerender method getLoginBean ().getJsf_scheduleRowSet ().setObject (1, getLoginBean ().getUsername ()); jsf_scheduleDataProvider.refresh (); getLoginBean ().getJsf_leavesRowSet ().setObject (1, getLoginBean ().getUsername ()); jsf_leavesDataProvider.refresh ();

Assignment Guideline 6 (cont)  Add the parameter to DataProvider  Choose the corresponding RowSet, double click on it  On the SQL screen, add the parameter with the “?” characters in the Where clause. Or click right mouse the field and choose Add Query Criteria …  Choose the parameter, then click Ok  Coding all the button in pages