Introduction to Web Programming

Gregg Sporar [email protected] Agenda

●What is Java? ●Web/Application Servers ●Servlets ●JSPs ●Java Web Frameworks ●JavaServer Faces ●Beyond the Java Language

2 What is Java?

● Runs Everywhere

● FREE and Open Source

3 Java Flavors

Java Micro Edition (Java ME)

Optional Packages

Optional Packages

Personal Personal Java Java Basis Profile Profile Enterprise Standard Edition Edition Foundation Profile MIDP (Java EE) (Java SE) Java CDC CLDC Card APIs

JVM KVM CardVM

4 “Hello World” in Java

5 A Specification...

6 Web/Application Servers

Firewall Java EE Application Client Server

Enterprise Enterprise Information Client JavaBeans™ Systems (EIS): Client Relational Database, Web Enterprise Legacy Client Server JavaBeans Applications, JSP, Servlets ERP Systems Client HTML/XML Other Services: JNDI, JMS, Enterprise Client Middle JavaMail™ Information Tier Tier Tier

7 Web/Application Servers ●Open Source ● Tomcat ● JBoss ● Geronimo ● GlassFish ●Proprietary ● WebSphere ● WebLogic ● OC4J 8 What is a Servlet?

A servlet is a Java programming language class used to extend the capabilities of servers that host applications accessed via a request- response programming model.

9 Servlet Processing

10 “Hello World” Java Servlet

11 Servlet Deployment

12 “Hello World” Revisited...

Not Very Robust....

13 What is a JSP?

JavaServer Page: 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, such as HTML, SVG, WML, and XML; ...and... JSP elements, which construct dynamic content.

14 “Hello World” with a JSP

15 You Might Be Wondering...

Why does the code do so much grunt work?

16 Java Web Frameworks

●Struts ●Tapestry ●Wicket ●Stripes ●Spring MVC ● ●JavaServer Faces (JSF) ●etc... 17 What is JavaServer Faces?

JavaServer Faces technology includes: * A set of APIs for representing UI components and managing their state, handling events and input validation, defining page navigation, and supporting internationalization and accessibility. * A JavaServer Pages (JSP) custom tag library for expressing a JavaServer Faces interface within a JSP page.

18 “Hello World” with JSF

19 “Hello World” with JSF (cont')

20 “Hello World” with JSF (cont'd)

21 “Hello World” with JSF (cont'd)

22 JSF Life cycle

Source: JSF for nonbelievers, by Rick Hightower 23 Beyond the Java Language

JavaFX Script

and more...

Development The Virtual Machine Devices

24 Beyond the Java Language (cont'd)

on

25 Resources ●Java: java.sun.com ●JavaPassion: javapassion.com ●Java EE: java.sun.com/javaee ●Servlets: java.sun.com/products/servlet/articles/tutorial/ ●JSP: java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPIntro.html ●JSF: www.ibm.com/developerworks/library/j-jsf1/ ●Ruby, JRuby, Rails: www.netbeans.org/kb/trails/ruby.html ●NetBeans: netbeans.org 26