An introduction to web programming with Java

Similar documents
2. Follow the installation directions and install the server on ccc

Creating Java EE Applications and Servlets with IntelliJ IDEA

Web Container Components Servlet JSP Tag Libraries

7 Web Databases. Access to Web Databases: Servlets, Applets. Java Server Pages PHP, PEAR. Languages: Java, PHP, Python,...

Handling the Client Request: Form Data

Java EE Introduction, Content. Component Architecture: Why and How Java EE: Enterprise Java

ACM Crossroads Student Magazine The ACM's First Electronic Publication

Session Tracking Customized Java EE Training:

AN OVERVIEW OF SERVLET AND JSP TECHNOLOGY

Database Applications Recitation 10. Project 3: CMUQFlix CMUQ s Movies Recommendation System

INTRODUCTION TO WEB TECHNOLOGY

Java Servlet and JSP Programming. Structure and Deployment China Jiliang University

Form Handling. Server-side Web Development and Programming. Form Handling. Server Page Model. Form data appended to request string

How to use JavaMail to send

Java Servlet Tutorial. Java Servlet Tutorial

Principles and Techniques of DBMS 5 Servlet

Building Web Applications with Servlets and JavaServer Pages

Servlets. Based on Notes by Dave Hollinger & Ethan Cerami Also, the Online Java Tutorial by Sun

PA165 - Lab session - Web Presentation Layer

J2EE Web Development. Agenda. Application servers. What is J2EE? Main component types Application Scenarios J2EE APIs and Services.

Implementing the Shop with EJB

Agenda. Summary of Previous Session. Application Servers G Session 3 - Main Theme Page-Based Application Servers (Part II)

Supplement IV.E: Tutorial for Tomcat. For Introduction to Java Programming By Y. Daniel Liang

Java Server Pages combined with servlets in action. Generals. Java Servlets

CONTROLLING WEB APPLICATION BEHAVIOR WITH

Controlling Web Application Behavior

CHAPTER 9: SERVLET AND JSP FILTERS

Virtual Open-Source Labs for Web Security Education

Web Programming with Java Servlets

2.8. Session management

Glassfish, JAVA EE, Servlets, JSP, EJB

Web Application Programmer's Guide

JavaServer Pages Fundamentals

Web Programming II JSP (Java Server Pages) ASP request processing. The Problem. The Problem. Enterprise Application Development using J2EE

Introduction to J2EE Web Technologies

Managing Data on the World Wide-Web

In this chapter, we lay the foundation for all our further discussions. We start

Chapter 1 Introduction to web development and PHP

Java Web Programming. Student Workbook

DTS Web Developers Guide

Web Development in Java Live Demonstrations (Live demonstrations done using Eclipse for Java EE 4.3 and WildFly 8)

How To Understand The Architecture Of Java 2Ee, J2Ee, And J2E (Java) In A Wordpress Blog Post

SESSION TRACKING. Topics in This Chapter

Pure server-side Web Applications with Java, JSP. Application Servers: the Essential Tool of Server-Side Programming. Install and Check Tomcat

BAPI. Business Application Programming Interface. Compiled by Y R Nagesh 1

Penetration from application down to OS

NetBeans IDE Field Guide

Servlet and JSP Filters

How to program Java Card3.0 platforms?

WebSphere and Message Driven Beans

Tutorial: Building a Web Application with Struts

Servers, Dynamic Web Projects, and Servlets

Web Applications. For live Java training, please see training courses at

Introduction to Web Technologies

CS108, Stanford Handout #33 Young. HW5 Web

Java 2 Web Developer Certification Study Guide Natalie Levi

Programming on the Web(CSC309F) Tutorial: Servlets && Tomcat TA:Wael Aboelsaadat

Model-View-Controller. and. Struts 2

CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, Java Servlets

Outline. CS 112 Introduction to Programming. Recap: HTML/CSS/Javascript. Admin. Outline

Website as Tool for Compare Credit Card Offers

Essentials of the Java(TM) Programming Language, Part 1

Improving Web Security Education with Virtual Labs and Shared Course Modules

Tutorial c-treeace Web Service Using Java

Web Frameworks and WebWork

Manual. Programmer's Guide for Java API

Java Server Pages and Java Beans

Eclectic Computing. Time Tracking Tool Software Architecture Document. Version <1.3>

SSC - Web development Model-View-Controller for Java web application development

Development. with NetBeans 5.0. A Quick Start in Basic Web and Struts Applications. Geertjan Wielenga

Web Application Development on a Linux System With a DB2 Database By Alan Andrea

Outline. Lecture 9: Java Servlet and JSP. Servlet API. HTTP Servlet Basics

Developing Java Web Applications with Jakarta Struts Framework

Course Number: IAC-SOFT-WDAD Web Design and Application Development

Managed Beans II Advanced Features

Database System Concepts

SERVLETSTUTORIAL. Simply Easy Learning by tutorialspoint.com. tutorialspoint.com

In this chapter the concept of Servlets, not the entire Servlet specification, is

Web Application Architecture (based J2EE 1.4 Tutorial)

Getting Started with Web Applications

Design Approaches of Web Application with Efficient Performance in JAVA

Development of a Real-time Customer Service System. Abstract

Java and Web. WebWork

Application Security

Virtual Credit Card Processing System

Automatic generation of distributed dynamic applications in a thin client environment

Ch-03 Web Applications

Oracle Application Server Single Sign-On

Class Focus: Web Applications that provide Dynamic Content

Arjun V. Bala Page 20

CHAPTER 5. Java Servlets

Java 2 Platform, Enterprise Edition (J2EE) Bruno Souza Java Technologist, Sun Microsystems, Inc.

ACI Commerce Gateway Hosted Payment Page Guide

Transcription:

Chapter 1 An introduction to web programming with Java Objectives Knowledge

Objectives (continued) The first page of a shopping cart application

The second page of a shopping cart application Components of a web application Client computer Server computer Internet connection Web browser Web server Database server

The components of a web application How a web server processes static web pages Client Server HTTP request Browser Web server HTML file HTTP response

How static web pages work How a web server processes dynamic web pages Client Server Browser HTTP request HTTP response Web server Web application

How dynamic web pages work The components of a Java web application Client Browser HTTP request HTTP response Server Web server Servlet/JSP engine Java Development Kit (JDK) Database server

Components needed for Java web application A JSP that displays three parameters entered by the user

An introduction to JavaServer Pages The code for the JSP <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <title>murach's Java Servlets and JSP</title> </head> <body> <% // get parameters from the request String firstname = request.getparameter("firstname"); String lastname = request.getparameter("lastname"); String emailaddress = request.getparameter("emailaddress"); %> <h1>thanks for joining our email list</h1>

The code for the JSP (continued) <p>here is the information that you entered:</p> <table cellspacing="5" cellpadding="5" border="1"> <tr> <td align="right">first name:</td> <td><%= firstname %></td> </tr> <tr> <td align="right">last name:</td> <td><%= lastname %></td> </tr> <tr> <td align="right">email address:</td> <td><%= emailaddress %></td> </tr> </table> The code for the JSP (continued) <p>to enter another email address, click on the Back <br> button in your browser or the Return button shown <br> below.</p> </body> </html> <form action="join_email_list.html" method="get"> <input type="submit" value="return"> </form>

Code for a servlet that works the same as the JSP package email; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class DisplayEmailListServlet extends HttpServlet { protected void doget( HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // get parameters from the request String firstname = request.getparameter("firstname"); String lastname = request.getparameter("lastname"); String emailaddress = request.getparameter("emailaddress"); Code for the servlet (continued) // return response to browser response.setcontenttype("text/html;charset=utf-8"); PrintWriter out = response.getwriter(); out.println( "<!doctype html public \" + "-//W3C//DTD HTML 4.0 Transitional//EN\">\n"" + "<html>\n" + "<head>\n" + " <title>murach's Java Servlets and JSP</title>\n" + "</head>\n" + "<body>\n" + "<h1>thanks for joining our email list</h1>\n" + "<p>here is the information that you entered:</p>\n" + " <table cellspacing=\"5\" cellpadding=\"5\" " + "border=\"1\">\n" + " <tr><td align=\"right\">first name:</td>\n" + " <td>" + firstname + "</td>\n" + " </tr>\n" + " <tr><td align=\"right\">last name:</td>\n" + " <td>" + lastname + "</td>\n" + " </tr>\n" + " <tr><td align=\"right\">email address:</td>\n" + " <td>" + emailaddress + "</td>\n" + " </tr>\n"

Code for the servlet (continued) } } + " </table>\n" + "<p>to enter another email address, click on the Back <br>\n" + "button in your browser or the Return button shown <br>\n" + "below.</p>\n" + "<form action=\"join_email_list.html\" >\n" + " <input type=\"submit\" value=\"return\">\n" + "</form>\n" + "</body>\n" + "</html>\n"); out.close(); Three environments for servlet and JSP development Stand-alone development JDK Tomcat MySQL Local Area Network development JDK Java EE JAR files LAN connection JDK Tomcat MySQL Client Server Internet development Client JDK Java EE JAR files Internet connection Server JDK Tomcat Apache MySQL

The architecture for a typical Java web application Presentation layer HTML files JSP files Business rules layer Servlets JavaBeans Other Java classes Data access layer Data access classes Database Text files Binary files XML files The architecture for a typical Java web application (continued)

The NetBeans IDE Popular IDEs for Java web development Description

An ISP that provides web hosting that supports servlets and JSPs The FileZilla program