1 Web Programming with Servlets & JSPs WEB APPLICATIONS – AN OVERVIEW.

Slides:



Advertisements
Similar presentations
M-V-C for web applications. Model for Web Applications model consists of data and system state database tables –persistent data session information –current.
Advertisements

Java Server Pages (JSP)
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
Java Servlet & JSP © copyright 2005 SNU OOPSLA Lab.
J.Sant Servlets Joseph Sant Sheridan Institute of Technology.
Servlets Stoney Jackson
WEB1P servintro1 Introduction to servlets and JSP Dr Jim Briggs.
An introduction to Java Servlet Programming
JSP Java Server Pages Reference:
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Server Side Web Technologies: Part 2.
Introduction to Web Based Application. Web-based application TCP/IP (HTTP) protocol Using WWW technology & software Distributed environment.
Introduction to Servlet & JSP
Comp2513 Java Servlet Basics Daniel L. Silver, Ph.D.
Java Server and Servlet CS616 Team 9 Kim Doyle, Susan Kroha, Arunima Palchowdhury, Wei Xu.
Web programming for project students Dr Jim Briggs.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
Servlets. Our Project 3-tier application Develop our own multi-threaded server Socket level communication.
SE-2840 Dr. Mark L. Hornick1 Java Servlet-based web apps Servlet Architecture.
Java Servlets and JSP.
Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
Server-side Technologies
Introduction Servlets and JSP Celsina Bignoli
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Server Side Scripting Norman White. Where do we do processing? Client side – Javascript (embed code in html) – Java applets (send java program to run.
INTRODUCTION TO WEB DATABASE PROGRAMMING
1 Servlet How can a HTML page, displayed using a browser, cause a program on a server to be executed?
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Introduction to Internet Programming (Web Based Application)
CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES LECTURE 5_1 George Koutsogiannakis/ Summer
Objectives Java Servlet Web Components
Functionality of a web server What does the web server do? Let a user request a resource Find the resource Return something to the user The resource can.
Java support for WWW Babak Esfandiari (sources: Qusay Mahmoud, Roger Impey, textbook)
111 Java Servlets Dynamic Web Pages (Program Files) Servlets versus Java Server Pages Implementing Servlets Example: F15 Warranty Registration Tomcat Configuration.
COMP 321 Week 7. Overview HTML and HTTP Basics Dynamic Web Content ServletsMVC Tomcat in Eclipse Demonstration Lab 7-1 Introduction.
CMPUT 391 – Database Management Systems Department of Computing Science University of Alberta CMPUT 391 Database Management Systems Web based Applications,
Web Server Programming 1. Nuts and Bolts. Premises of Course Provides general introduction, no in-depth training Assumes some HTML knowledge Assumes some.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Java Servlets & Java Server Pages Lecture July 2013.
Java Servlets Lec 27. Creating a Simple Web Application in Tomcat.
1 CS122B: Projects in Databases and Web Applications Spring 2015 Notes 03: Web-App Architectures Professor Chen Li Department of Computer Science CS122B.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
20-Nov-15introServlets.ppt Intro to servlets. 20-Nov-15introServlets.ppt typical web page – source Hello Hello.
A seminar on j2ee by saritha. s. What is J2EE J2EE (Java 2 Platform, Enterprise Edition) is a Java platform designed for the mainframe-scale computing.
@2008 Huynh Ngoc Tin Chapter #2 JAVA SERVLET PRGRAMMING.
L.MARIA MICHAEL VISUWASAM UNIT-4
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
Java Servlets and Java Server Pages Norman White Stern School of Business.
Middleware 3/29/2001 Kang, Seungwoo Lee, Jinwon. Description of Topics 1. CGI, Servlets, JSPs 2. Sessions/Cookies 3. Database Connection(JDBC, Connection.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, Responds oriented other.
1 Introduction to Servlets. Topics Web Applications and the Java Server. HTTP protocol. Servlets 2.
CS320 Web and Internet Programming Introduction to Java Servlets Chengyu Sun California State University, Los Angeles.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 21 Java Servlets Wed. 11/22/00 based on material.
Java Servlets and Java Server Pages
HTTP protocol Java Servlets. HTTP protocol Web system communicates with end-user via HTTP protocol HTTP protocol methods: GET, POST, HEAD, PUT, OPTIONS,
How CGI and Java Servlets are Run By David Stein 14 November 2006.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Bayu Priyambadha, S.Kom. Static content  Web Server delivers contents of a file (html) 1. Browser sends request to Web Server 3. Web Server sends HTML.
1 Lecture 8 George Koutsogiannakis/Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
CS320 Web and Internet Programming Introduction to Java Servlets Chengyu Sun California State University, Los Angeles.
Speaker Name Speaker Title Speaker Title Oracle Corporation Olivier Le Diouris Principal Product Manager Oracle Corporation Building Servlet and JSP Applications.
Distributed Web Systems Java Servlets Lecturer Department University.
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.
CS3220 Web and Internet Programming Introduction to Java Servlets
Servlet Fudamentals.
Java Servlets By: Tejashri Udavant..
Chapter 27 WWW and HTTP.
Introduction to Servlets
COP 4610L: Applications in the Enterprise Spring 2005
CS3220 Web and Internet Programming Introduction to Java Servlets
CS122B: Projects in Databases and Web Applications Winter 2019
Presentation transcript:

1 Web Programming with Servlets & JSPs WEB APPLICATIONS – AN OVERVIEW

Objectives  Web Client – Server Model  Evolution of Servlets  Web Application  Web Application Development Process  Servlet API  Workshops 2

Client – Server Model 3 Advantages of Web Application Easier access to information Lower maintenance and deployment costs Platform independency Wider visibility

Architecture of Web Applications 4 N – tiers Architecture

5 How Web Server works ? Translate 2. Server name – Microsoft.com 3. File name – index.htm 1. Protocol – HTTP address Connect Browser send a GET request Server response as HTML format

6 Web server …? File system contains HelloWorld.html

Communication/ Protocols Http Protocol Request Message structures Response Message structures

Request Objects 8  Request Parameters  Request Methods

Limitation of Web Servers 9  Not feasible to maintain static content from the customer’s end  Can not be managed the dynamic Web contain from client  Overloading errors  Unavailability due to maintenance  Heavy traffic  High maintenance costs  Virus or worms attacks

10 Architechture : Web Application Collect information Send Request to Web ServerExecute Server Script Response result to browser

11 Server Side Script  Common Gateway Interface (CGI).  ISAPI  Server-side JavaScript (SSJS).  Personal Home Page (PHP).  Java Servlet  Active Server Page (ASP)  Java Server Page (JSP).  Ruby on Rail  ASP.net  …………………………………..

CGI 12 Disadvantages Reduced efficiency Reloading Perl interpreter No Session #include void main() { printf(“ \n”); printf(“ My CGI program \n”); printf(“ Hello \n”); printf(“ \n”); }

Servlets 13

Web Application 14  Concepts  Registered into WWW  Accessible from a public server  Comprises servlets, JSPs, images, HTML, JavaBeans, applets, and Java classes  Portability  Store in WAR files to deploy on the Web server

Web Application Directory Structure 15

Web Deployment Descriptor – web.xml servlet name [package.]classname servlet name /context Path/root 30 default page to show Place in WEB-INF folder

Example HelloServlet demo.HelloServlet HelloServlet /Welcome Welcome index.jsp Alias Name

Web Application Development Process in NetBeans 18  Step 1: Creating a new project  Step 2: Specifying Name and Location for the Project  Step 3: Creating the new Web files.  Step 4: Specifying the Name of the Servlets  Step 5: Writing the code for Servlet & Compile  Step 6: Package Servlet into WAR file  Step 7: Deploying in a Web Container  Step 8: Executing the Servlet

Creating a new project  Click menu File  Click the “New Project” Items

Creating the new Web Project  Click Web categories  Click the “Web Application” Projects  Click Next button

Specifying Name and Location for the Project Fill your project name Browser your location where store the project  Click Finish button

Choose Server 22 Choose WebServer and Context Path, click “Next”, “Finish”

Web Application Directory Structure in Netbeans Project name Interactive Web Directory Web Deployment descriptor Configuration directory related define for Web App Source java class required for Web App Lib directory required for Web App

Create Servlet 24

Named for Servlet 25 Name Must have Package name Click :”Next”  “Finish”

Writing the code for Servlet & Compile  Modify the processRequest method in servlet class. Ex: protected void processRequest (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType ("text/html;charset=UTF-8"); PrintWriter out = response.getWriter (); out.println(" "); out.println(" Hello Servlet "); out.println(" "); out.println(" Welcome to Servlet course "); out.println(" "); out.close (); }

Writing the code for Servlet & Compile (cont)

Package Servlet into WAR file  Package War file with command prompt  jar –cvf fileName.war directoryOrFile (using blank to separate)  Ex: jar –cvf HelloServlet.war *.jsp WEB-INF/*  You can manual deploy this application : copy.war file to folder TOMCAT_HOME/webapps

Executing the Servlet

GenericServlet Class 30

HTTPServlet Class 31

Workshop Activities 32 Building the first Servlet named HelloServlets to greet the user “Hello Servlets” in the Web browser. Notes: The NetBean runs the Servlet with the Tomcat Server version