510 likes | 516 Views
This course is focused on building interactive web-based applications using industry-standard technologies such as HTML, HTTP, Java Servlets, Java Server Pages (JSPs), databases and JDBC, and XML and web services. The course will provide a strong foundation in web development and cover practical programming practices.
E N D
Welcome!Applied Internet Technology V22.0480-005 Spring, 2006 Professor Sana` Odeh New York University Course Introduction
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). • Administrative Matters • Prerequisites, Grading, Text Books • Office Hours, Course Web site • Syllabus Course Introduction
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 Course Introduction
Course Description • This is a course in building interactive web-based applications. • The course is divided into five main tracks of learning: • Foundations of the Web • Java Servlets • Java Server Pages (JSPs) • Databases and JDBC • XML and Web Services Course Introduction
Track 1:Foundations of the Web Course Introduction
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. Course Introduction
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. Course Introduction
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? Course Introduction
Common Gateway Interface (CGI)http://i5.nyu.edu/~sao1/forms/movies_perl_cgi.html • 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. Course Introduction
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. Course Introduction
Track 2:Java Servlets Course Introduction
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. Course Introduction
How a Servlet Works Web Browser Web Server Java Servlet Course Introduction
Advantages of Servlets • Very clean, elegant interface • Built-in Security • Fast Performance • Object Oriented • Exception Handling • Cross-Platform • Scalable to very large audiences Course Introduction
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 Course Introduction
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. Course Introduction
import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public 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>"); } } View example from the web (HelloWWW ) Course Introduction
Track 3: Java Server Pages Course Introduction
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. Course Introduction
JSP Example <HTML> <BODY> <% for (int i=1; i<10; i++) { %> <FONT FACE=ARIAL SIZE="<%= i %>"> Hello, World!</FONT> <P> <% } %> </BODY> </HTML> Course Introduction
JSP Topics • We will cover the following JSP topics: • JSP Expressions • JSP Scriptlets • JSP Error Pages • File Inclusion Options • JSP and Java Beans Course Introduction
Track 4: Databases and JDBC Course Introduction
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. Course Introduction
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 Course Introduction
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 Course Introduction
Track 5: XML and Web Services Course Introduction
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. Course Introduction
Applications of XML • Widely used today in lots of different types of applications: • Search Engines • News / Headline Distribution • E-Commerce / Finance • Real Estate • Bioinformatics Course Introduction
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 Course Introduction
XML Example : CD Collection <?xml version="1.0" encoding="ISO8859-1" ?> <CATALOG> <CD> <TITLE>Empire Burlesque</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> A Disclaimer: I did not pick these CDs! I just got the example off the web :-) Continued... Course Introduction
<CD> <TITLE>Hide your heart</TITLE> <ARTIST>Bonnie Tylor</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>CBS Records</COMPANY> <PRICE>9.90</PRICE> <YEAR>1988</YEAR> </CD> <CD> <TITLE>Unchain my heart</TITLE> <ARTIST>Joe Cocker</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>EMI</COMPANY> <PRICE>8.20</PRICE> <YEAR>1987</YEAR> </CD> </CATALOG> Note that indentation helps you follow the flow of the document. http://www.w3schools.com/xsl/cdcatalog.xml Course Introduction
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. Course Introduction
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. Course Introduction
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"> Hello, World! </text> </svg> <rect> element: Create a rectangle at the specified location. <text> element: Create text at specified location. Course Introduction
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"/> </svg> <animate> element: animate the hello text, over a 2 second interval. Course Introduction
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 3 second interval. Course Introduction
Understanding J2EE:Java Enterprise Edition Course Introduction
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) Course Introduction
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… Course Introduction
What we will not cover • JavaScript • Flash • Dynamic HTML • Cascading Style Sheets • And, the list goes on… Course Introduction
Administrative Matters Course Introduction
Software • Students will have to install software locally: • Tomcat Server to a local PC, Mac and any platform you have and do everything locally. Course Introduction
Prerequisites • 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. Course Introduction
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/ Course Introduction
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 Course Introduction
Online Tutorials • In addition to the two books, the course references several online tutorials. • For example, we will be using the MySQL Documentation. Course Introduction
Lecture Notes • Lecture notes will be available as on the course web site. • Occasionally, I will provide in-class handouts. Course Introduction
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. Course Introduction
Getting Help • If you need help, you always have two options: • Office Hours: every Monday, 12:00 - 1 pm Location: 418 in Warren Weaver Hall • Class E-Tutor: available by email to help out with any homework questions. Course Introduction
Course Web Site • The Course Web Site is available at: http://www.cs.nyu.edu/courses/spring06/V22.0480-005/index.html • Let’s check it out… Course Introduction