1 Introduction to Web Applications & APIs. 2 Agenda  Architecture of Web Applications Three layer architecture  Web Server (Tomcat) Installation Data.

Slides:



Advertisements
Similar presentations
Kyung Hee University 1 1 Application Layer. 2 Kyung Hee University Position of Application Layer.
Advertisements

1 Chapter 12 Working With Access 2000 on the Internet.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
Introduction to Web Database Processing
1 C. Shahabi Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California
1 Build a Web Application on J2EE. 2 J2EE Scenario Client – Web Server – EIS Resources Client – Web Server – EIS Resources Client – Application Server.
Introduction to Web Interface Technology (CSE2030)
DT228/3 Web Development Databases. Database Almost all web application on the net access a database e.g. shopping sites, message boards, search engines.
Introduction to Web Interface Technology (CSE2030)
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
Julien Thibault / Phil Brewster / Kristina Doing-Harris
ECE356 – Database Systems Lab 1 – Building a Web Project with NetBeans Tiuley Alguindigue Lab Instructor – University of Waterloo, E & CE Dept. Fall 2013.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
Java Servlets and JSP.
Chapter 1 Web Server Setup and Configuration. Contents A.What is web server B.Installing and Configuring Web Server C.Testing the Installation.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
UNIT-V The MVC architecture and Struts Framework.
By: Shawn Li. OUTLINE XML Definition HTML vs. XML Advantage of XML Facts Utilization SAX Definition DOM Definition History Comparison between SAX and.
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB.
INTRODUCTION TO WEB DATABASE PROGRAMMING
 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Getting connected.  Java application calls the JDBC library.  JDBC loads a driver which talks to the database.  We can change database engines without.
CSCI 6962: Server-side Design and Programming
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 29.1 Multi-Tier Architecture 29.2 Web Servers.
Chapter 16 The World Wide Web Chapter Goals Compare and contrast the Internet and the World Wide Web Describe general Web processing Describe several.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
CREATED BY ChanoknanChinnanon PanissaraUsanachote
Pemrograman Berbasis WEB XML -Aurelio Rahmadian- Sumber: w3cschools.com.
Views, Indexes and JDBC/JSP tutorial Professor: Dr. Shu-Ching Chen TA: Haiman Tian 1.
CIS 270—Application Development II Chapter 25—Accessing Databases with JDBC.
CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES LECTURE 5_1 George Koutsogiannakis/ Summer
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
HTML. Principle of Programming  Interface with PC 2 English Japanese Chinese Machine Code Compiler / Interpreter C++ Perl Assembler Machine Code.
Tutorial 10 by Sam ine1020 Introduction to Internet Engineering 1 Database & Server-side Scripting Tutorial 10.
Designing and Developing WS B. Ramamurthy. Plans We will examine the resources available for development of JAX-WS based web services. We need an IDE,
1 Welcome to CSC 301 Web Programming Charles Frank.
Index and JDBC/JSP tutorial Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
WEB APPLICATION DEVELOPMENT For More visit:
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
1 Introduction to Web Applications & APIs: Tutorial Presented by Julian Guo and Jonathan Jiang, Department of MIS, The University of Arizona Course MIS.
JSP Server Integrated with Oracle8i Project2, CMSC691X Summer02 Ching-li Peng Ying Zhang.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
Database Access Using JDBC BCIS 3680 Enterprise Programming.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
JDBC CS 260 Database Systems. Overview  Introduction  JDBC driver types  Eclipse project setup  Programming with JDBC  Prepared statements  SQL.
Field Trip #24 Setting Up a Web Server. Apache Apache is one of the most successful open source web servers In 1995 the most popular web server was the.
AJAX. Ajax  $.get  $.post  $.getJSON  $.ajax  json and xml  Looping over data results, success and error callbacks.
JAVA, JEE Training Introduction to Web Harinath Mallepally
1 Download current version of Tomcat from: g/tomcat/ g/tomcat/ Install it in: C:\Program Files\Apache.
Java High level programming language ◦ Sun Microsystems ◦ ORACLE acquired Java Development Kit – JDK Java Runtime Environment – JRE Java Virtual Machine.
A Presentation Presentation On JSP On JSP & Online Shopping Cart Online Shopping Cart.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
Introduction to Dynamic Web Programming
JDBC Database Management Database connectivity
PHP / MySQL Introduction
Chapter 27 WWW and HTTP.
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
Installing Tomcat.
Web Application Development Using PHP
Presentation transcript:

1 Introduction to Web Applications & APIs

2 Agenda  Architecture of Web Applications Three layer architecture  Web Server (Tomcat) Installation Data structure  Web Application  Database ODBC Libraries Demo  Xml Rules of XMLs XML APIs  APIs Amazon API Flicker API YouTube API

3 Architecture of Web Applications

4  Three layer architecture  Client Application Client application provides interfaces to interact with users. For web applications, client applications are browsers. The contents displayed on the client application are obtained from the application server. After receiving inputs from users, the client application submits the user inputs to the application server. Users

5 Architecture of Web Applications  Application Server Application server is a container which allow server applications to run within it. Application server handles the requests from the client application and pass them to the server application. These requests are generally sent through HTTP (Hypertext Transfer Protocol), which specifies a set of methods and headers that allow clients and servers to interact and exchange information. Server application then processes the requests and sends the responses back to the client application. Server application can also accesses database via JDBC, if database manipulations are needed.  Database Many software can be used to store and manage data (e.g., MS SQL, Oracle, and MySql)

6 Web Server

7  To build a web application, we need a server which is able to deal with Http requests Server applications  Therefore, web server is chosen based on the programming languages by which the server application is coded.  Apache Tomcat Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages (JSP) technologies.  Windows Service Installer (6.0.20) Prerequisite – JDK 1.6  JDK 6 Update 17 with Java EE  (  IIS – for ASP.Net

8 Apache Tomcat  Installation Setup the connection port, user name and password  Installation complete

9 Apache Tomcat  Test

10 Apache Tomcat  File Structure TomcatRoot  C:\Program Files\Apache Software Foundation\Tomcat 6.0 (default) TomcatRoot/bin  Executable files Tomcat6.exe – command line mode; Tomcat6w.exe – service mode TomcatRoot/conf - Configuration files of Tomcat TomcatRoot/lib  Libraries/APIs required to run Tomcat TomcatRoot/logs - Log files TomcatRoot/webapps (  Application root – Put your web applications under this folder TomcatRoot/work  Used to store compiled JSP files (cache).

11 Web Application Using eclipse as an example

12 Create A Web Application Project  Create A Web Application Eclipse -> File -> New - > Dynamic Web Project Put in the project name (ex. WebApp1) -> Next  WebApp1/

13 Create A Web Application Project  src The source code folder  build\classes The folder for compiled class files  Click Next

14 Create A Web Application Project  Click finish

15 Web Application Project – File Structure  Deployment Description Summarizes current status and setting of the project  Java Resource: src The folder for java source codes (such as.java files)  JavaScript Resources Built-in JavaScript libraries  Build The fold of compiled class files (*.class) and imported APIs  WebContent (Root Folder of the application) All application contents should be put under this folder. WEB-INF (the system folder of a web application) contains  Configuration files (WEB-INF/web.xml)  Complied java codes (WEB-INF/classes)  Third-party libraries/APIs (WEB-INF/lib)

16 Deploy A Web Application Project  To deploy a web application, we first package the web application into a WAR file.  Deploy Right-click on the project -> Export Choose “WAR file” - > click next

17  Specify the output location and click finish.  Deploy Copy the “WAR file” to the AppRoot of the TomCat Server  C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps by default Delete the existing project folder Restart Tomcat Deploy A Web Application Project

18 Database

19 Database  A database is an organized collection of data.  There are many different strategies for organizing data to facilitate easy access and manipulation.  A database management system (DBMS) provides mechanisms for storing, organizing, retrieving and modifying data for many users.

20 JDBC (Java Database Connectivity)  Java programs communicate with databases and manipulate their data using the JDBC API.  A JDBC driver enables Java applications to connect to a database in a particular DBMS and allows you to manipulate that database using the JDBC API.  Using the JDBC API enables developers to change the underlying DBMS without modifying the Java code that accesses the database.  Most popular database management systems now provide JDBC drivers. There are also many third-party JDBC drivers available.

21

22 JDBC API  Java APIs Java APIs are jar files which can be unzipped by compression software. Java API jar files contain compiled java codes (.class) organized by following their packaged names. Some Java APIs also contain source codes.  jTDS ( jTDS is an open source 100% pure Java (type 4) JDBC 3.0 driver for Microsoft SQL Server (6.5, 7, 2000, 2005 and 2008) and Sybase (10, 11, 12, 15) dist.zip/download dist.zip/download Connection String  jdbc:jtds: :// [: ][/ ][; = [;...]] jtds jar

23 Import APIs Into A Web Application  To use third-party APIs, we have to import these APIs into our project. 1.Put third-party APIs under the lib folder  Copy your API (jar) files into the folder WEB-INF/lib  If “Referenced Libraries” contains APIs just copied, we are all set. Otherwise, go to step 2. 2.Import APIs into your project  Right click on the project -> “properties”  In the properties window, choose “Java Build Path” -> “Libraries” tab  Click “Add JARs” -> select the APIs you want to import in the pop-up window -> Click “OK”  Now, we can see the selected APIs displayed in the properties window. Click “OK” on the properties window.  “Referenced Libraries” should contains APIs imported.

24 Step 2: import APIs into project

25 Step 3

26 Data Scheme Used in The Demo Authors NameData TypeNULL authorIDintNOT NULL PRIMARY KEY firstNamenvarchar(50)NULL lastNamenvarchar(50)NULL AuthorISBN NameData TypeNULL authorIDintNOT NULL isbnnvarchar(20)NOT NULL Titles NameData TypeNULL isbnnvarchar(20)NOT NULL PRIMARY KEY titlenvarchar(100)NULL editionNumberintNULL copyrightnvarchar(10)NULL

27 Sample Code  Showing how to connect to a database, retrieve data based on a given SQL, and display the results on a JSP. 

28 Command Types  boolean execute() Executes the SQL statement in this PreparedStatement object, which may be any kind of SQL statement.  ResultSet executeQuery() Executes the SQL query in this PreparedStatement object and returns the ResultSet object generated by the query.  int executeUpdate() Executes the SQL statement in this PreparedStatement object, which must be an SQL INSERT, UPDATE or DELETE statement; or an SQL statement that returns nothing, such as a DDL statement.

29 XMLs XML (

30 Introduction  What is XML XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to carry data, not to display data XML tags are not predefined. You must define your own tags XML is designed to be self-descriptive XML is a W3C Recommendation  The World Wide Web Consortium (W3C) is the main international standards organization for the World Wide Web

31 Introduction  XML is Everywhere RSS are XMLs We have been participating in XML development since its creation. It has been amazing to see how quickly the XML standard has developed, and how quickly a large number of software vendors has adopted the standard. XML is now as important for the Web as HTML was to the foundation of the Web. XML is everywhere. It is the most common tool for data transmissions between all sorts of applications, and is becoming more and more popular in the area of storing and describing information.

32 XML Tree Everyday Italian Giada De Laurentiis Harry Potter J K. Rowling Learning XML Erik T. Ray

33 XML Rules  XML documents must contain one and only one root element. This element is "the parent" of all other elements.  All XML Elements Must Have a Closing Tag  XML Tags are Case Sensitive  XML Elements Must be Properly Nested  XML Attribute Values Must be Quoted

34 XML Elements  What is an XML Element? An XML element is everything from (including) the element's start tag to (including) the element's end tag. An element can contain other elements, simple text or a mixture of both. Elements can also have attributes. In the example, and have element contents, because they contain other elements. has text content because it contains text. “XPath” can be used to identify elements.  From the “bookstore” element, “book/title” can be used to identify “title” elements. Harry Potter J K. Rowling Learning XML Erik T. Ray

35 XML APIs  jdom: m zip m zip Unzip jdom zip  “jdom.jar” under the “build” folder  “jaxen.jar” and “Saxpath.jar” under the “lib” folder

36 APIs Flicker YouTube Amazon

37 Flicker API  General Info Main page of flicker API  Description of the flicker search function  html html Flicker search API explorer  html html Apply API key  Query example  s.search&api_key=2d752c2f6b090dbb52a3bed85e30bb d2&text=paris s.search&api_key=2d752c2f6b090dbb52a3bed85e30bb d2&text=paris

38 Flicker API  Steps to search Flicker Apply for a API key Send a search request to Flicker server Receive the query result (XML format) Parse the result and display photos on a jsp

39 YouTube API  General Info Main page of YouTube API  _java.html _java.html Apply API Key  uide_java.html#Authentication Description of the YouTube video search function  _java.html#Searching_for_Videos _java.html#Searching_for_Videos Query parameter definition  ml#Query_parameter_definitions Query example 

40 YouTube API  Steps to search YouTube Apply for a API key Send a search request to YouTube server Receive the query result (XML format) Parse the result and display videos on a jsp  Have to handle namespace issue

41 Amazon API  General Info Main page of Amazon Product Advertising API  program.amazon.com/gp/advertising/api/detail/main.ht ml program.amazon.com/gp/advertising/api/detail/main.ht ml Java Developer Center  ervice/ /GSG/ ervice/ /GSG/ API Key  Commons Codec Download  c.cgi

42 Amazon API  Import commons-codec-1.4.jar  Steps to search Amazon Apply for a API key Generate search conditions Generate a parameter string Generate a string to sign Generate a signature Generate a query URL Send a search request to Amazon server Receive the query result (XML format) Parse the result and display products on a jsp  Have to handle namespace issue