WEB1P servintro1 Introduction to servlets and JSP Dr Jim Briggs.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10 Servlets and Java Server Pages.
Advertisements

CGI programming. Common Gateway Interface interface between web server and other programs (cgi scripts) information passed as environment variables passed.
Java Server Pages (JSP)
JSP1 Java Server Pages (JSP) Introducing JavaServer Pages TM (JSP TM ) JSP scripting elements.
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
Java Servlet & JSP © copyright 2005 SNU OOPSLA Lab.
Technology Overview JAVA Servlets CS-611 S. Witherspoon.
JSP: JavaServer Pages Juan Cruz Kevin Hessels Ian Moon.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
Servlets and a little bit of Web Services Russell Beale.
An introduction to Java Servlet Programming
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.
JSP Java Server Pages Reference:
Java Server Team 8. Overview What is a Java Server? History Architecture Advantages Disadvantages Current Technologies Conclusion.
Introduction to Servlet & JSP
Java Server and Servlet CS616 Team 9 Kim Doyle, Susan Kroha, Arunima Palchowdhury, Wei Xu.
Web programming for project students Dr Jim Briggs.
JSP Architecture  JSP is a simple text file consisting of HTML or XML content along with JSP elements  JSP packages define the interface for the compiled.
SE-2840 Dr. Mark L. Hornick1 Java Servlet-based web apps Servlet Architecture.
Introduction to Java web programming Dr Jim Briggs JWP intro1.
Chapter 10 Servlets and Java Server Pages. A servlet is a Java class designed to be run in the context of a special servlet container An instance of the.
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 Enterprise Edition Java Web Development Structure of a web project Introduction to Web Applications The first project Introduction to Java Web Development.
Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
Introduction Servlets and JSP Celsina Bignoli
Overview of JSP Technology. The need of JSP With servlets, it is easy to – Read form data – Read HTTP request headers – Set HTTP status codes and response.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 9 JavaServer Pages (JSP) (Based on Møller.
Applets & Servlets.
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
JSP Java Server Pages Softsmith Infotech.
Java support for WWW Babak Esfandiari (sources: Qusay Mahmoud, Roger Impey, textbook)
Deploying CFML on J2EE Servers Vince Bonfanti President New Atlanta Communications, LLC.
Standalone Java Application vs. Java Web Application
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.
JAVA SERVER PAGES. 2 SERVLETS The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
JAVA SERVER PAGES CREATING DYNAMIC WEB PAGES USING JAVA James Faeldon CS 119 Enterprise Systems Programming.
Webcommerce Computer Networks Webcommerce by Linnea Reppa Douglas Martindale Lev Shalevich.
Java Servlets & Java Server Pages Lecture July 2013.
Chapter 7 Using Custom Tag Libraries and the JSP Standard Tag Library.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
Java Server Pages (JSP)
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.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
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.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 1COMP9321, 15s2, Week.
STRUCTURE OF JSP PRESENTED BY: SIDDHARTHA SINGH ( ) SOMYA SHRIVASTAV ( ) SONAM JINDAL ( )
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
Chapter 6 Chapter 6 Server Side Programming (JSP) Part 1 1 (IS 203) WebProgramming (IS 203) Web Programming.
Java Server Pages. 2 Servlets The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
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 Web Programming with Servlets & JSPs WEB APPLICATIONS – AN OVERVIEW.
Speaker Name Speaker Title Speaker Title Oracle Corporation Olivier Le Diouris Principal Product Manager Oracle Corporation Building Servlet and JSP Applications.
Introduction Servlets and JSP
JSP (Java Server Page) JSP is server side technology which is used to create dynamic web pages just like Servlet technology. This is mainly used for implementing.
Java Servlets By: Tejashri Udavant..
By Dr. Kodge Bheemashankar G
Knowledge Byte In this section, you will learn about:
MSIS 655 Advanced Business Applications Programming
Servlets and Java Server Pages
Distributed System Using Java 2 Enterprise Edition (J2EE)
Introduction to Servlets
Presentation transcript:

WEB1P servintro1 Introduction to servlets and JSP Dr Jim Briggs

WEB1P servintro2 Java technology Concept of a Java Virtual Machine (JVM) Portability Three kinds of Java program –Applications –Applets –Servlets

WEB1P servintro3 Auxiliary server

WEB1P servintro4 Architecture of a Java web application

WEB1P servintro5 Servlets Created when the servlet container first receives a request that maps onto it Servlet services request via thread Servlet object continues to exist until container closes down

WEB1P servintro6 Advantages of servlets over CGI 1 more efficient –the same process handles each HTTP request –code is loaded into memory only once –only a new thread is created for each request –servlets remain in memory when completed so it is straightforward to store data between requests more convenient –there is an extensive infrastructure for: decoding form data –reading and setting HTTP headers –handling cookies –tracking sessions –accessing databases

WEB1P servintro7 Advantages of servlets over CGI 2 more powerful –servlets can talk directly to the web server (makes redirection possible) –multiple servlets can share data –maintain information from request to request more portable –very strong standard API makes porting servlets between implementations is very easy inexpensive (but then so are many CGI tools!) –the J2EE is made available by Sun free of charge –Tomcat is available free from Apache

WEB1P servintro8 Advantages of servlets over CGI 3 more secure –not run via an operating system shell (that might treat some characters specially) –Java is not susceptible to buffer overflow attacks like C/C++ more mainstream –proven technology –supported by major companies like IBM, Oracle, Sun, Macromedia –runs on many operating systems –used by many large companies

WEB1P servintro9 Servlet container Program that implements the Java servlet and JSP specifications Part of the Java 2 Enterprise Edition (J2EE) Reference implementation used to be Tomcat (an Apache project) Full J2EE reference implementation now is Glassfish

Mapping URLs to servlets Consider the URL: – Container must break this down – virtual hostwww.myserver.com –/myapp: context or web application –/myservlet: address within web application WEB1P servintro10

WEB1P servintro11

WEB1P servintro12 Web applications A container may run several (independent) web applications (webapps) Each must have a WEB-INF directory: –web.xml configuration file –classes directory –lib directory

WEB1P servintro13 Important classes and interfaces 1 All servlets must implement the Servlet interface Class HttpServlet –init/destroy –doGet/doPut –Your servlet will derive from this

WEB1P servintro14 Important classes and interfaces 2 2 parameters to a request handling method Class HttpServletRequest –String param = request.getParameter(name); Class HttpServletResponse –PrintWriter out = response.getWriter(); Class HttpSession –Holds data common to related requests

WEB1P servintro15 Example servlets hello HelloYou HelloMime

WEB1P servintro16 JavaServer Pages (JSP) Distinction: –servlets: HTML embedded in program –JSP: program embedded in HTML Useful where majority of effort is page design Translated automatically into a servlet –Retranslated if changed (no need to restart server) Can be placed anywhere in a web application –but not visible to client if in the WEB-INF directory

WEB1P servintro17 JSP elements Scriptlets Actions Directives Standard tags Custom tags Expression language

WEB1P servintro18 Scriptlets Any Java code between Expressions – Declarations – DEPRECATED –Do not use - not XML –Much easier to use JSTL

WEB1P servintro19 Actions Including other files – –Request time inclusion Accessing beans –

WEB1P servintro20 Directives Page directive – Include directive – –Translation time inclusion

WEB1P servintro21 Standard tags Java Standard Tag Library (JSTL) –Taglib directive –Core –SQL –XML –Format

WEB1P servintro22 Custom tags Implement your own tags Create a Tag Library Definition (tld) file Extend predefined classes Specify your library in directive Use like JSTL tags

WEB1P servintro23 Expression language Refer to Java Beans and other common classes ${expression} can appear as tag attributes or (since JSP 2.0) in the page itself Several implicit objects: –header ${header["user-agent"]} –param ${param['name']} ${param.name}

Web programming languages Programmatic –Output HTML in print statements –Use normal programming language constructs Examples: –Perl –Java (servlets) –C/C++ Better when the complexity is in the data capture and processing Output-based –HTML page with programming statements embedded –Can require contrived programming language constructs Examples: –PHP –ASP –Java (Java Server Pages) Better when the complexity is in the output format 24WUCM1