You are on page 1of 52

Welcome!

Applied Internet
Technology
V22.0480-002
Spring, 2004

Ethan Cerami
New York University

10/17/08 Course Introduction 1


Road Map
 Course Description
 What’s this class all about?
 Our five tracks of learning
 For each track, we will have a mini-preview of
things to come… (Hello, World examples).
 Class Ice Breaker…
 Administrative Matters
 Prerequisites, Grading, Text Books
 Office Hours, Course Web site
 Syllabus

10/17/08 Course Introduction 2


Course Description
 Official Title: Applied Internet Technology
 “Applied”:
 Focus on real world web applications
 Focus on current industry standards
 Focus on what people actually do in the
“real world.”
 Instead of theory, we focus on “rules of
thumb”
 Focus on good programming practices

10/17/08 Course Introduction 3


Course Description
 This is a course in building interactive web-
based applications.
 The course is divided into five main tracks of
learning:
1) Foundations of the Web
2) Java Servlets
3) Java Server Pages (JSPs)
4) Databases and JDBC
5) XML and Web Services

10/17/08 Course Introduction 4


Changes from Previous
Semesters
 This is now the fourth time NYU has offered
this course.
 This semester, I have made substantial
changes to the curriculum:
 New Text Books with better examples.
 Updated coverage to cover the very latest
Java/XML standards.
 Expanded coverage of XML and Web Services.
 New Programming Projects.

10/17/08 Course Introduction 5


Track 1:
Foundations of the Web

10/17/08 Course Introduction 6


Foundations of the Web
 To build web applications, you first need to
understand the foundations of the web:
 HyperText Markup Language (HTML)
 HyperText Transfer Protocol (HTTP)
 Common Gateway Interface (CGI)
 Cookies
 The first week of the course will be devoted to
these topics.

10/17/08 Course Introduction 7


HTML Coverage
 We will spend exactly one lecture on HTML,
and focus exclusively on building HTML
Forms.
 These forms will eventually talk to the Java
Servlet examples we build later in the course.
 Most students are expected to already know
the basics of HTML. If not, there are a
number of good tutorials on the web.

10/17/08 Course Introduction 8


HTTP
 HyperText Transfer Protocol: The defined
standard of communication between web
browsers and web servers.
 Coverage:
 How does HTTP work?
 What’s the difference between GET and POST?
 How does it affect my web applications?
 How does it affect servlet development?

10/17/08 Course Introduction 9


Common Gateway Interface
 A generic framework for building dynamic
web applications.
 Usually written in Perl.
 For example:
 User submits a search keyword.
 Perl program searches file system and returns
matches.
 Java Servlets represent a much more
effective framework than CGI, and we will
therefore focus on Servlets.

10/17/08 Course Introduction 10


Cookies
 Small piece of data that is created on a web
server, and stored on the client’s machine.
 Very useful tool for creating personalized
sites, shopping carts, etc.
 We will examine the Cookie specification in
detail.
 When we move onto Servlets, we will revisit
the cookie specification.

10/17/08 Course Introduction 11


Track 2:
Java Servlets

10/17/08 Course Introduction 12


Java Servlets
 A very effective framework for building
interactive web applications.
 Requires previous knowledge of Java,
and Java object oriented practices.
 Servlets are the industry standard for
building web applications today.

10/17/08 Course Introduction 13


How a Servlet Works

Web Web Java


Browser Server Servlet

10/17/08 Course Introduction 14


Advantages of Servlets
 Very clean, elegant interface
 Built-in Security
 Fast Performance
 Object Oriented
 Exception Handling
 Cross-Platform
 Scalable to very large audiences

10/17/08 Course Introduction 15


Servlet Topics
 We will cover Java Servlets extensively:
 Advantages/Disadvantages of Servlets
 Building your first Java Servlet
 Working with Apache Tomcat
 The Servlet Application Programming
Interface (API)
 The Servlet Life Cycle
 Servlet/Web Browser Communication
 Session/Cookie Tracking
 Loads of examples

10/17/08 Course Introduction 16


A Preview of things to come…
 Creating a Hello, World servlet is very
straightforward.
 If you know Java well, you can already
probably understand the code.
 Let’s take a look at the code…
 Don’t worry if it doesn’t make sense yet.

10/17/08 Course Introduction 17


mport java.io.*;
mport javax.servlet.*;
mport javax.servlet.http.*;

ublic class HelloWWW extends HttpServlet {


public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<HTML>\n" +
"<HEAD><TITLE>Hello WWW</TITLE></HEAD>\n"
"<BODY>\n" +
"<H1>Hello WWW</H1>\n" +
"</BODY></HTML>");
}
http://www.ecerami.com/servlet/HelloWWW
10/17/08 Course Introduction 18
Track 3: Java Server Pages

10/17/08 Course Introduction 19


Java Server Pages
 Represents an alternative for building
web applications.
 Java Servlets look like regular Java
programs.
 JSP pages look more like HTML.
 JSP pages are therefore ideal for
controlling the look and feel of a page.

10/17/08 Course Introduction 20


JSP Example
<HTML>
<BODY>
<% for (int i=1; i<10; i++) { %>
<FONT FACE=ARIAL SIZE="<%= i %>">
Hello, World!</FONT>
<P>
<% } %>
</BODY>
</HTML>
http://ecerami.com/jsp/hello.jsp
10/17/08 Course Introduction 21
JSP Topics
 We will cover the following JSP topics:
 JSP Expressions
 JSP Scriptlets
 JSP Error Pages
 File Inclusion Options
 JSP and Java Beans

10/17/08 Course Introduction 22


Track 4: Databases and JDBC

10/17/08 Course Introduction 23


JDBC
 JDBC represents a high-level API for connecting to
relational databases.
 Most Internet sites are populated with data from
databases, and JDBC is therefore a very important
topic.
 In this course, we will focus on the specifics of using
the open-source MySQL database.
 Each student will receive a MySQL account (or can
install MySQL locally), and will be able to create their
own tables.
 Each student will also be able to create standalone
and servlet applications which connect to MySQL.

10/17/08 Course Introduction 24


JDBC Example
Sample Code:

String query = "SELECT COF_NAME, PRICE FROM COFFEES";


ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
String s = rs.getString("COF_NAME");
float n = rs.getFloat("PRICE");
System.out.println(s + " " + n);
}

Sample Output:

Colombian 7.99
French_Roast 8.99
Espresso 9.99
Colombian_Decaf 8.99
French_Roast_Decaf 9.99
10/17/08 Course Introduction 25
JDBC Topics
 We will cover beginner-to-intermediate topics
in JDBC:
 Working with MySQL
 Crash Course in SQL
 Setting up Tables via JDBC
 Updating Tables via JDBC
 Querying Tables via JDBC
 Prepared Statements
 Transactions

10/17/08 Course Introduction 26


Track 5: XML and Web Services

10/17/08 Course Introduction 27


eXtensible Markup Language
 XML is a W3C standard for creating
data formats on the web.
 Unlike HTML which has a fixed set of
tags, XML enables you to create new
tags and new data formats.
 XML is maturing, and is now considered
essential for web development.

10/17/08 Course Introduction 28


Applications of XML
 Widely used today in lots of different
types of applications:
 Search Engines

 News / Headline Distribution

 E-Commerce / Finance

 Real Estate

 Bioinformatics

10/17/08 Course Introduction 29


XML Topics
 We will cover XML extensively:
 Introduction to XML and its applications

 Document Type Definitions (DTDs)

 Introduction to XML Parsing

 Adding XML to your Java applications and servlets

 Simple API for XML (SAX)

 JDOM

 Introduction to Web Services and SOAP

10/17/08 Course Introduction 30


XML Preview: SVG
 Scalable Vector Graphics (SVG) is an XML
standard for creating 2D graphics and
animations on the web.
 SVG documents are basically XML
documents.
 The XML tags indicate the location of text,
graphics, shapes, etc.
 The XML can also indicate animations and
transition effects.
 Represents one of the easiest, most
compelling ways to learn XML.
10/17/08 Course Introduction 31
SVG Plug-In
 To try out SVG, you first need to
download the Adobe SVG Plug-In.
 Just go to:
 http://www.adobe.com/svg/
 Download the Plug-In for your Web
Browser.

10/17/08 Course Introduction 32


SVG Example #1
Root <svg> element: Create a
200x200 Box
<?xml version="1.0" encoding="iso-8859-1"?>
<svg width="200" height="200"
viewBox="0 0 200 200">
<rect x="10" y="20" width="180"
height="100" fill="#eeeeff" stroke="red"
stroke-width="1" />
<text x="24" y="75" font-family="sans-serif"
font-size="20pt" fill="blue"> <rect>
Hello, World! <text> element:
</text> element: Create a
</svg> Create text rectangle at
at specified the specified
10/17/08 location.
Course Introduction location. 33
SVG, Example #2
<?xml version="1.0" encoding="iso-8859-1"?>
<svg width="200" height="200" viewBox="0 0 200 200“>
<rect x="10" y="20" width="180" height="100"
fill="#eeeeff" stroke="red" stroke-width="1"/>
<text id="hello" x="24" y="75" font-family="sans-serif"
font-size="20pt" fill="blue">Hello, World!</text>
<animate xlink:href="#hello"
attributeName="dx"
values="-15;15;-15" dur="2s" begin="0s"
repeatDur="indefinite"/> <animate>
</svg> element:
animate the
hello text,
over a 2
10/17/08 second
Course Introduction 34
SVG Example #3
<?xml version="1.0" encoding="iso-8859-1"?>
<svg width="700" height="200" viewBox="0 0 700 200>
<text id="hello" x="5" y="150" font-family="sans-serif"
font-size="1pt" fill="blue">
Hello, World!
</text>
<animate xlink:href="#hello"
attributeName="font-size" values="1;196;1"
dur="3s" begin="0s" repeatDur="indefinite"/>
</svg> <animate>
element:
animate
the font
size over a
10/17/08
3 second
Course Introduction 35
Understanding J2EE:
Java Enterprise Edition

10/17/08 Course Introduction 36


Flavors of Java
 There are two general flavors of Java:
 J2SE: Java 2 Standard Edition (Java 1.4)
 J2EE: Java 2 Enterprise Edition (Java 1.4)
 A common question regarding this
class: are we are covering J2EE?

10/17/08 Course Introduction 37


J2EE Topics
 J2EE is a comprehensive set of API for building
enterprise applications.
 The complete API includes the following:
 JDBC (covered in course)
 Remote Method Invocation (RMI)
 Java Servlets (covered in course)
 JSPs (covered in course)
 Java Naming and Directory Interface (JNDI)
 Enterprise Java Beans (EJBs)
 Java and XML (covered in course)
 Java Messaging System (JMS)
 Of these 8 topics, we are covering 4 of them.
 Hence, the course covers roughly half of the entire
J2EE API.

10/17/08 Course Introduction 38


Our constraints
 The Web is constantly evolving, new
technologies are constantly appearing.
 There is no way that we could hope to
cover all the technologies or all the
important topics.
 Hence, there are lots of topics that we
will not cover…

10/17/08 Course Introduction 39


What we will not cover
 Enterprise Java Beans (EJBs)
 JavaScript
 Flash
 Dynamic HTML
 Cascading Style Sheets
 And, the list goes on…

10/17/08 Course Introduction 40


Class Ice-Breaker
 A chance for me to meet you.
 Information about you:
 Name
 Describe an interesting programming
project; or
 Describe an interesting computer-related
internship or work experience.

10/17/08 Course Introduction 41


Administrative Matters

10/17/08 Course Introduction 42


Software
 Students will have two options for
writing software:
 Option 1: Install the Tomcat Server to a
local PC, and do everything locally.
(Recommended)
 Option 2: Use the Tomcat Server on the
NYU i5 Unix System.

10/17/08 Course Introduction 43


Prerequisites
 First: You need to know Java and object
oriented concepts.
 The better you know Java, the better you will be
able to do the Servlet/XML assignments.
 The first week does not require Java, but after
that, all assignments will be in Java.
 Second: If you choose option 2 from the
previous slide, you must be familiar with using
the UNIX Operating System.
 Basic commands, navigating directories, FTP,
moving/copying files, etc.
 Basic Text Editor, e.g. vi or pico.
10/17/08 Course Introduction 44
Text Book #1:
Core Servlets and JSPs
 By Marty Hall and
Larry Brown
 A Sun
Microsystems
Press/Prentice
Hall PTR Book
 Book Web site
with Examples:
http://coreservlets.com/

10/17/08 Course Introduction 45


Text Book #2:
Processing XML with Java
 By Elliotte Rusty Harold
 Complete contents are
also available online:
http://cafeconleche.org/books/xmljava/
 All Examples:
http://cafeconleche.org/books/xmljava/examples/index.html

10/17/08 Course Introduction 46


Online Tutorials
 In addition to the two books, the course
references several online tutorials.
 For example, we will be using the MySQL
Documentation.

10/17/08 Course Introduction 47


Lecture Notes
 Lecture notes will be available as on the
course web site.
 Occasionally, I will provide in-class
handouts.

10/17/08 Course Introduction 48


Exams and Grading
 Grade Distribution:
 projects (30%)
 midterm exam (30%)
 and final exam (40%)
 Projects:
 Students will have to complete a half
dozen programming projects.

10/17/08 Course Introduction 49


Getting Help
 If you need help, you always
have two options:
 Office Hours: every
Wednesday, 9:15 - 11:15 am
Location: 427 Warren
Weaver Hall
 Class E-Tutor: available by
email to help out with any
homework questions.

10/17/08 Course Introduction 50


Course Web Site
 The Course Web Site is available at:

http://www.ecerami.com/applied_spring_20
 Let’s check it out…

10/17/08 Course Introduction 51


Syllabus
 Available online at the course web site.
 Let’s take a look at what we will be
covering….

10/17/08 Course Introduction 52

You might also like