Technology Overview JAVA Servlets CS-611 S. Witherspoon.

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10 Servlets and Java Server Pages.
Servlets, JSP and JavaBeans Joshua Scotton.  Getting Started  Servlets  JSP  JavaBeans  MVC  Conclusion.
1 Servlets Based on Notes by Dave Hollinger & Ethan Cerami Also, the Online Java Tutorial by Sun.
J.Sant Servlets Joseph Sant Sheridan Institute of Technology.
Servlets and a little bit of Web Services Russell Beale.
WEB1P servintro1 Introduction to servlets and JSP Dr Jim Briggs.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
18-Jun-15 JSP Java Server Pages Reference: Tutorial/Servlet-Tutorial-JSP.html.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 34 Servlets.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Server Side Web Technologies: Part 2.
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
Java Server Team 8. Overview What is a Java Server? History Architecture Advantages Disadvantages Current Technologies Conclusion.
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.
Session-01. What is a Servlet? Servlet can be described in many ways, depending on the context: 1.Servlet is a technology i.e. used to create web application.
Chapter 4 Servlets Concept of Servlets (What, Why, and How) Servlet API Third-party tools to run servlets Examples of Using Servlets HTML tag with GET.
Servlets Compiled by Dr. Billy B. L. Lim. Servlets Servlets are Java programs which are invoked to service client requests on a Web server. Servlets extend.
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. What Are Servlets? Basically, a java program that runs on the server Basically, a java program that runs on the server Creates dynamic.
Java Server Programming Jeff Schmitt Towson University October 15, 1998.
Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
Intro to Servlets Lec 26. Web-Based Enterprise Applications in Java Figure shows a simplified view of one application and its layers.
Server-side Technologies
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Applets & Servlets.
Database Management Systems 1 Oracle Programming.
Servlets, Sessions, and Cookies Lecture 8 cs193i – Internet Technologies Summer 2004 Kelly Shaw, Stanford University.
Java Servelets. What Is a Servlet? A servlet is a Java programming language class used to extend the capabilities of servers that host applications accessed.
Servlets Pranav Maydeo. What is a Servlet ? Servlets are modules of Java code that run in a server application to answer client requests. Servlets are.
Java Omar Rana University of South Asia. Course Overview JAVA  C/C++ and JAVA Comparison  OOP in JAVA  Exception Handling  Streams  Graphics User.
Java Servlets CS-422. Application Mapping Your servlet application will be mapped to a directory structure: –“myapp” maps to some directory C:/docs/apps/myapp.
Servlets. - Java technology for Common Gateway Interface (CGI) programming. - It is a Java class that dynamically extends the function of a web server.
AN OVERVIEW OF SERVLET TECHNOLOGY SERVER SETUP AND CONFIGURATION WEB APPLICATION STRUCTURE BASIC SERVLET EXAMPLE Java Servlets - Compiled By Nitin Pai.
Objectives Java Servlet Web Components
Java support for WWW Babak Esfandiari (sources: Qusay Mahmoud, Roger Impey, textbook)
Web Server Programming 1. Nuts and Bolts. Premises of Course Provides general introduction, no in-depth training Assumes some HTML knowledge Assumes some.
Chapter 3 Servlet Basics. 1.Recall the Servlet Role 2.Basic Servlet Structure 3.A simple servlet that generates plain text 4.A servlet that generates.
Webcommerce Computer Networks Webcommerce by Linnea Reppa Douglas Martindale Lev Shalevich.
Java Servlets & Java Server Pages Lecture July 2013.
Chapter 6 Server-side Programming: Java Servlets
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)
® IBM Software Group © 2007 IBM Corporation Best Practices for Session Management
@2008 Huynh Ngoc Tin Chapter #2 JAVA SERVLET PRGRAMMING.
Java Servlets and Java Server Pages Norman White Stern School of Business.
1 Java Servlets l Servlets : programs that run within the context of a server, analogous to applets that run within the context of a browser. l Used to.
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.
JS (Java Servlets). Internet evolution [1] The internet Internet started of as a static content dispersal and delivery mechanism, where files residing.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
Advanced Java Session 6 New York University School of Continuing and Professional Studies.
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
CSI 3125, Preliminaries, page 1 JSP (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,
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.
Java Servlets References: Karen Anewalt, Mary Washington College.
CS122B: Projects in Databases and Web Applications Spring 2017
CS122B: Projects in Databases and Web Applications Winter 2017
Servlets.
Java Servlets By: Tejashri Udavant..
Java Servlets.
By Dr. Kodge Bheemashankar G
Servlet.
Chapter 26 Servlets.
CS122B: Projects in Databases and Web Applications Winter 2018
CS122B: Projects in Databases and Web Applications Spring 2018
Presentation transcript:

Technology Overview JAVA Servlets CS-611 S. Witherspoon

JAVA Servlets What are servlets Why use them Anatomy of a servlet Sample servlets Servlets & J2EE

Servlet paradigm

Description Servlets are the Java platform technology of choice for extending and enhancing web servers Servlets are programs that run on a Web server and build Web pages based on data: Submitted by user Data that changes frequently Data from corporate databases or other sources

HTTP servlet

Advantage of Servlets Over CGI Efficient Runs in the Java Virtual Machine Each request is handled by lightweight thread Only 1 copy of servlet class in memory Optimization alternative ( caching previous computations, keeping database connections open)

Advantage of Servlets Over CGI Convenient Extensive infrastructure for automatically parsing and decoding HTML form data, reading and setting HTTP headers, handling cookies, tracking sessions Servlets receive all the benefits of the JAVA language (portability, performance, reusability and crash protection)

Advantage of Servlets Over CGI Powerful Servlets have access to the entire family of JAVA APIs, including JDBC TM API to access enterprise databases Servlets can talk directly to Web servers Servlets can talk and share data with each other

Advantage of Servlets Over CGI Inexpensive Adding server support to your web server is inexpensive of free (Apache Tomcat) Disadvantage?? You must learn Java!!

Anatomy of a Servlet Server Servlet code Load Client Handle Client Requests Unload

Anatomy of a Servlet init() destroy() service() doGet() doPost()

Anatomy of a Servlet HTTPServletRequest object Information about an HTTP request Headers Query String Session Cookies HTTPServletResponse object Used for formatting an HTTP response Headers Status codes Cookies

Sample Servlets Servlet ExamplesServlet Examples (localhost) or CSDateTime DemoCSDateTime Demo (remote host)

Sample Servlet (source code) Sue Example CSDateTime

Software Setup Directory Structure /webapps/ROOT/WEB-INF/classes Environment Variables JAVA_HOME J2EE_HOME CLASSPATH=$JAVA_HOME/jre/lib/ Path Settings PATH=$JAVA_HOME/bin:$J2EE_HOME/bin:$PATH

Compiling the Servlet Sun ONE Studio Open.java Select Compile under Build menu Copy resultant.class file to : /webapps/ROOT/WEB-INF/classes w/o JAVA ToolKit cd /webapps/ROOT/WEB-INF/classes javac.java

Running the Servlet Make sure Web Server (Tomcat) is running Bring up Web Browser Bring up Servlet /servlet/

Enterprise Servlets and J2EE

Distributed Environment (rules of thumb) Instance variables and static variables should not be used to store state The context should not be used to store application state Any object placed into an HttpSession should be capable being moved to a different machine Avoid using java.io package for file access, use getServletContext().getResource() Syncrhonization is not global and works only for the local JVM