L05-Servlets - Session 5 Servlet Intro Internet Commerce...

Info icon This 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
Image of page 1

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

View Full Document Right 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 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
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
Image of page 3

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

View Full Document Right 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
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 The Web Server primarily serves d l http method MIME files Sometimes both servers are © Robert Kelly, 2001-2010 9 resources, and passes complex request to the Application Server packaged together, but it is best
Image of page 5

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern