1 / 20

AddressBook using Servlets and Intro to JSP

AddressBook using Servlets and Intro to JSP. Lec - 33. Servlets Example. A part of Address Book. Design Process. Step 1 – Create a database (AddressBook) Make a table named Person. Design Process. Step 2 – Make a PersonInfo class Three attributes: name, address, ph. No.

jared
Download Presentation

AddressBook using Servlets and Intro to JSP

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. AddressBook using ServletsandIntro to JSP Lec - 33

  2. Servlets Example A part of Address Book

  3. Design Process • Step 1 – Create a database (AddressBook) • Make a table named Person

  4. Design Process • Step 2 – Make a PersonInfo class • Three attributes: name, address, ph. No. • Has Parameterized constructor • Override toString() method • Step 3 – Make a DAO class which contains • an establishConnection( ) method • a searchPerson(string name) method that returns PersonInfo object

  5. Design Process • Step 4 – Write SearchPerson servlet • Will take input for name to search in address book • Submits the request to ShowPerson servlet • Step 5 – Write ShowPerson servlet • Recieves request from SearchPerson servlet • Instantiate objects of PersonInfo and DAO class • Call searchPerson method • Show results

  6. package • What is package? • Examples: • java.lang • Javax.swing • How to use package • import java.lang.*; • import javax.swing.*;

  7. JSP Example A part of Address Book

  8. JavaServer Pages Overview

  9. Agenda • Introducing JavaServer PagesTM (JSPTM) • JSP scripting elements • The JSP page Directive • Including Files in JSP Documents • Using JavaBeans™ components with JSP • Creating custom JSP tag libraries • Integrating servlets and JSP with the MVC architecture

  10. The Need for JSP • With servlets, it is easy to • Read form data • Read HTTP request headers • Set HTTP status codes and response headers • Use cookies and session tracking • Share data among servlets • Remember data between requests • Get fun, high-paying jobs • But, it sure is a pain to • Use those println statements to generate HTML • Maintain that HTML

  11. The JSP Framework • Idea: • Use regular HTML for most of page • Mark servlet code with special tags • Entire JSP page gets translated into a servlet (once), and servlet is what actually gets invoked (for each request)

  12. What are Java Server Pages? • The Java Server Pages technology combine Java code and HTML tags in the same document to produce a JSP file. = JSP + Java <HTML>

  13. Advantages of JSP Over Competing Technologies • Versus ASP or ColdFusion • Better language for dynamic part • Portable to multiple servers and operating systems • Versus PHP • Better language for dynamic part • Better tool support • Versus WebMacro or Velocity • Standard • Versus pure servlets • More convenient to create HTML • Can use standard tools (e.g., UltraDev) • Divide and conquer • JSP developers still need to know servlet programming

  14. JSP/Servlets in the Real World • Google:the world’s biggest search portal

  15. JSP/Servlets in the Real World • ofoto.com:print and manage digital and conventional photos.

  16. JSP/Servlets in the Real World First USA Bank: largest credit card issuer in the world; most on-line banking customers

  17. JSP/Servlets in the Real World Delta Airlines: entire Web site, including real-time schedule info

  18. JSP/Servlets in the Real World American Century Investments: more than 70 mutual funds, $90 billion under management, two million investors

  19. JSP/Servlets in the Real World • Excite: one of the top five Internet portals; one of the ten busiest sites on the Web

  20. JSP – The Page becomes a Class • Page Compiler • Chunks • Page compiled into a Servlet • First invocation is slow – has to compile • Subsequent invocations more rapid

More Related