L05-Servlets - Session 5 Servlet Intro Internet Commerce Programming Session 5 Introduction to Servlets 1 Lecture Objectives Understand the popular

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Session 5 – Servlet Intro Internet Commerce Programming 9/19/2010 1 © Robert Kelly, 2001-2010 Session 5 Introduction to Servlets 1 Lecture Objectives Understand the popular approaches to generating HTML on a server Know how the Hello World servlet operates Understand the interaction among the browser, Web server, application server, and servlet code Understand the servlet life cycle © Robert Kelly, 2001-2010 2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Session 5 – Servlet Intro Internet Commerce Programming 9/19/2010 2 © Robert Kelly, 2001-2010 Reading & Reference Head First Servlets & JSP Chapter 1 & 2 J2EE 5 Reference Download the Servlet documentation – located at: jcp.org/aboutJava/communityprocess/mrel/jsr154/index2 .html Use the Sun on-line Servlet API documentation at: java.sun.com/javaee/5/docs/api/ © Robert Kelly, 2001-2010 3 http spec www.ietf.org/rfc/rfc2616.txt?number=2616 Typical Current Web Architecture URL Qt i HTTP Web Container Browser HTML, CSS, MIME Type Display Web Server HTTP interface Application Server Servlet handler URL / Query string / HTTP data, cookies, etc. HTML, Images, cookies, etc. req res JDBC • WWW resources, each named with a URL © Robert Kelly, 2001-2010 4 Database • WWW data classes, each with a type • Standard content formats (e.g., HTML) • Standard network protocols connecting any browser with any server
Background image of page 2
Session 5 – Servlet Intro Internet Commerce Programming 9/19/2010 3 © Robert Kelly, 2001-2010 Why Do We Need To Generate HTML? Include information from databases and mainframe systems (shopping sites) Include information from Web services Generate personalized content (e.g. myYahoo and Amazon) Generate content common to multiple pages © Robert Kelly, 2001-2010 5 Strategies to Generate HTML Common Gateway Interface (CGI) HTML request triggers the execution of a script Old technology New process for every request Limited access to server data Server scripting The concepts used in © Robert Kelly, 2001-2010 6 Microsoft ASP.NET Java Servlet / JSP the Java and Microsoft environments are very similar
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Session 5 – Servlet Intro Internet Commerce Programming 9/19/2010 4 © Robert Kelly, 2001-2010 What is a Servlet? A Java class that can be loaded dynamically to expand the capability of the Web server Runs inside the Java Virtual Machine on the server (safe and portable) Able to access all Java APIs supported in the server © Robert Kelly, 2001-2010 7 Does not have a main method (just like an applet) Servlet Implementation Some Platforms (Web Containers) IBM WebSphere BEA WebLogic Apache (Jakarta TomCat) Glassfish JBoss © Robert Kelly, 2001-2010 8
Background image of page 4
Session 5 – Servlet Intro Internet Commerce Programming 9/19/2010 5 © Robert Kelly, 2001-2010 Servlet / Web Server Interface HttpServlet subclass Service methods (doGet and doPost Web Server request response Web Container (doGet and doPost) The Web Server primarily serves http method MIME files Sometimes both servers are © Robert Kelly, 2001-2010 9 resources, and passes complex request to the Application Server
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/22/2011 for the course CSE 336 taught by Professor Kelly,r during the Fall '08 term at SUNY Stony Brook.

Page1 / 16

L05-Servlets - Session 5 Servlet Intro Internet Commerce Programming Session 5 Introduction to Servlets 1 Lecture Objectives Understand the popular

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online