Introduction to Java Servlets on Jakarta Tomcat

Slides:



Advertisements
Similar presentations
Apache Tomcat as a container for Servlets and JSP
Advertisements

 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.
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.
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.
Java Servlets and JSP.
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.
Apache Jakarta Tomcat Suh, Junho. Road Map Tomcat Overview Tomcat Overview History History What is Tomcat? What is Tomcat? Servlet Container.
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
Introduction Servlets and JSP Celsina Bignoli
Apache Tomcat Web Server SNU OOPSLA Lab. October 2005.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Applets & Servlets.
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. - 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
CMPUT 391 – Database Management Systems Department of Computing Science University of Alberta CMPUT 391 Database Management Systems Web based Applications,
Java Servlets & Java Server Pages Lecture July 2013.
Java Servlets Lec 27. Creating a Simple Web Application in Tomcat.
Using Novell GroupWise ® 6 Monitor Duane Kuehne Software Engineer Novell, Inc. Danita Zanre Senior Consultant NSC Sysop,
Chapter 2 Web app architecture. High-level web app architecture  When a client request coming in and needs servlet to serve dynamic web content, what.
Java Servlet API CGI / HTTP Concepts Java Servlet API.
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.
1 Introduction to Servlets. Topics Web Applications and the Java Server. HTTP protocol. Servlets 2.
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.
Java Servlets and Java Server Pages
How CGI and Java Servlets are Run By David Stein 14 November 2006.
1 Web Programming with Servlets & JSPs WEB APPLICATIONS – AN OVERVIEW.
Distributed Web Systems Java Servlets Lecturer Department University.
CS122B: Projects in Databases and Web Applications Spring 2017
Introduction to Servlets
CS122B: Projects in Databases and Web Applications Winter 2017
Introduction Servlets and JSP
Server Side Programming
Intermediate Programming with GroupWise® C3POs™
Servlet Fudamentals.
Java Servlets By: Tejashri Udavant..
Net-centric Computing
Course Outcomes of Advanced Java Programming AJP (17625, C603)
Programming with NetWare® XPlat APIs
Creating Novell Portal Services Gadgets: An Architectural Overview
Integrating Web Applications with Novell eDirectory™
HTTP Servlet Overview Servlets are modules that extend request/response-oriented servers, such as Java-enabled web servers. For example, a servlet might.
It’s one Net for Mac Users Too
MSIS 655 Advanced Business Applications Programming
Apache Tomcat Web Server
CS122B: Projects in Databases and Web Applications Winter 2018
Introduction to Servlets
CS122B: Projects in Databases and Web Applications Spring 2018
Objectives In this lesson you will learn about: Need for servlets
Introduction to Novell GroupWise® Token API
COP 4610L: Applications in the Enterprise Spring 2005
Java Servlets and JSP.
Introduction to Java Servlets
CS122B: Projects in Databases and Web Applications Winter 2019
Introduction to Servlet
Basic servlet structure
Java Chapter 7 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

Introduction to Java Servlets on Jakarta Tomcat Novell BrainShare 2002 Introduction to Java Servlets on Jakarta Tomcat Moises Morales Software Engineer Novell, Inc. mmorales@novell.com DCB124—Introduction to Java Servlets on Jakarta Tomcat

Introduction Goals of the session one Net Novell BrainShare 2002 Introduction Goals of the session Learn about Java servlets: Their architecture, uses, and how to write them* Learn about Jakarta Tomcat Servlet Gateway *Some background of Java programming is expected one Net The servlet technology is Java-based and cross-platform, making it possible to run of different networks more securely and efficiently and powering the web by giving solutions for eCommerce DCB124—Introduction to Java Servlets on Jakarta Tomcat

Vision…one Net Mission Novell BrainShare 2002 Vision…one Net A world where networks of all types—corporate and public, intranets, extranets, and the Internet—work together as one Net and securely connect employees, customers, suppliers, and partners across organizational boundaries Mission To solve complex business and technical challenges with Net business solutions that enable people, processes, and systems to work together and our customers to profit from the opportunities of a networked world DCB124—Introduction to Java Servlets on Jakarta Tomcat

Origin of Servlets: How They Started Novell BrainShare 2002 Origin of Servlets: How They Started Java applets vs. servlets Applets are Java programs which can be embedded directly into the webpages to add more functionality Applet gets downloaded to the client and then executed when we hit a web page with it If the size of applet grows, it increases download time and is inefficient Applets are also dependent on browsers The output can look different, raising compatibility issues If an applet is changed to be server-side, then it is executed on the server rather than the client This can avoid the aforementioned drawbacks Java servlets are like applets, not as graphical but executed on the server DCB124—Introduction to Java Servlets on Jakarta Tomcat

Origin of Servlets (cont.) Novell BrainShare 2002 Origin of Servlets (cont.) CGI vs. servlets Common Gateway Interface (CGI), traditionally used for developing web applications CGI is server-side and the web server creates a process to listen to requests, which are processed and send back to the server, then replied to the client With each CGI request, as new process is created and this could be cumbersome when there are too many requests Wastes of resources and slows the response time Browser could timeout if the CGI request abnormally terminates, as they run on different process than the web servers Java servlets can accomplish all the tasks of CGI more efficiently Servlets have session tracking built in DCB124—Introduction to Java Servlets on Jakarta Tomcat

What are Servlets? Servlets are dynamically-loaded Java modules that extends the functionality of a web server by taking requests from the client and executing them on the server Java servlets runs fully inside the JVM JVM Request Client/ browser Server Servlet Response

Why Servlets? Uses Practical application Portable Efficient Secure Robust Integration Practical application eCommerce

Servlet Architecture Servlets are based on two main packages Novell BrainShare 2002 Servlet Architecture Servlets are based on two main packages javax.servlet javax.servlet.http GenericServlet HttpServlet This class is extended from GenericServlet class DCB124—Introduction to Java Servlets on Jakarta Tomcat

Servlet Architecture (cont.) Novell BrainShare 2002 Servlet Architecture (cont.) Lifecycle of a servlet init() This method is called as soon as the servlet is instantiated service() This method then handles the client requests destroy() To mark the end of the servlet, for example, when the servlet service is completed, this method is used DCB124—Introduction to Java Servlets on Jakarta Tomcat

Hello World Example import java.io.*; import javax.servlet.*; Novell BrainShare 2002 Hello World Example import java.io.*; import javax.servlet.*; import javax.servlet,http.*; public class HelloWorld extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); out.println(“Hello World!”); } DCB124—Introduction to Java Servlets on Jakarta Tomcat

Then What Are JSPs? Java server pages Novell BrainShare 2002 Then What Are JSPs? Java server pages Java technology to create dynamic HTML on server-side Lets you combine static and dynamic HTML It is actually servlet code embedded on the page It is easier to use JSP when there is a lot of HTML used as it can be cumbersome to have the println statement generate HTML Behind the scenes, when a Java server page is hit, the server automatically creates, compiles, and runs servlet object Servlets can do anything that JSPs can accomplish DCB124—Introduction to Java Servlets on Jakarta Tomcat

Java Servlet Development Kit (JSDK) Novell BrainShare 2002 Java Servlet Development Kit (JSDK) To use Java servlets, the JSDK is needed along with a capable servlet web engine The JSDK 2.x is available for download from http://java.sun.com/products/servlet/ DCB124—Introduction to Java Servlets on Jakarta Tomcat

Popular Servlet and JSP Engines to Run on Novell NetWare® Server Novell BrainShare 2002 Popular Servlet and JSP Engines to Run on Novell NetWare® Server Jakarta Tomcat http://jakarta.apache.org/tomcat Tomcat runs on Apache server, but can be integerated with NetWare Enterprise Web Server IBM WebSphere Shipped with NetWare 5.1 GNU JSP http://www.klomp.org/gnujsp Jetty http://sourceforge.net/projects/jetty Novell Servlet Gateway Supports only the old servlet specification 2, to be discontinued soon DCB124—Introduction to Java Servlets on Jakarta Tomcat

Jakarta Servlet Engine (Tomcat) Novell BrainShare 2002 Jakarta Servlet Engine (Tomcat) Jakarta is an Apache project Tomcat is one of its subprojects Tomcat is the official reference implementation for the Java servlet and JavaServer pages technologies (according to Sun’s specifications) Tomcat is developed in an open and participatory environment and released under the Apache software license DCB124—Introduction to Java Servlets on Jakarta Tomcat

Downloading the Jakarta Software Novell BrainShare 2002 Downloading the Jakarta Software Current and previous versions of Jakarta are available http://jakarta.apache.org/builds/jakarta-tomcat/ Jakarta is downloadable as source code or binary Supported platforms include NetWare, UNIX, Linux, Windows, and others DCB124—Introduction to Java Servlets on Jakarta Tomcat

Download the Jakarta Software Novell BrainShare 2002 Download the Jakarta Software To get the binaries, download the following files Released Java binaries—jakarta-tomcat-3.3.zip http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.3/bin Released NetWare Apache module—mod_jk.nlm http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.3/bin/netware/i386 Additional connectors nsapi_rd.nlm—enterprise server connector jni_conn.nlm—JNI connector DCB124—Introduction to Java Servlets on Jakarta Tomcat

Download the Jakarta Software Novell BrainShare 2002 Download the Jakarta Software To build the source, download the following files Released source code—JAKARTA-TOMCAT-3.3-SRC.ZIP http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.3/src Unpack JAKARTA-TOMCAT-3.3-SRC.ZIP to an appropriate directory and read README to get additional components necessary for building Metrowerks Code Warrior 5 or later is required for building the native connectors DCB124—Introduction to Java Servlets on Jakarta Tomcat

Configuring Jakarta/Tomcat Novell BrainShare 2002 Configuring Jakarta/Tomcat General configuration in tomcat\conf\server.xml General web server connector configuration in tomcat\conf\workers.properties Tomcat can auto-generate an Apache configuration file that can be included in HTTPD.CONF tomcat\conf\mod_jk.conf-auto Tomcat must be started before Apache for this file to be created and have correct information DCB124—Introduction to Java Servlets on Jakarta Tomcat

Adding Additional Servlets, JSPs, and Web Applications Novell BrainShare 2002 Adding Additional Servlets, JSPs, and Web Applications Individual servlets can be placed in TOMCAT_HOME\webapps\ROOT\WEB-INF\classes Additional contexts are created under the TOMCAT_HOME\webapps directory Each directory becomes its own context Behavior for a context is defined by the WEB-INF\WEB.XML file Jakarta uses Web Application Archive (WAR) files .WAR files are automatically extracted during startup An appropriate context is created DCB124—Introduction to Java Servlets on Jakarta Tomcat

Hands-On Hello World Session Test

Hello World Example import java.io.*; import javax.servlet.*; Novell BrainShare 2002 Hello World Example import java.io.*; import javax.servlet.*; import javax.servlet,http.*; public class HelloWorld extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); out.println(“Hello World!”); } DCB124—Introduction to Java Servlets on Jakarta Tomcat

Need More Help? There are a lot of online Java resources at Novell BrainShare 2002 Need More Help? There are a lot of online Java resources at http://java.sun.com Novell Developer Kit (NDK) site at http://developer.novell.com Open a incident with Novell Developer Support (free of charge for internal developers) Newsgroups on the NDK site More questions? Send me an e-mail at mmorales@novell.com DCB124—Introduction to Java Servlets on Jakarta Tomcat