CS 562 Advanced Java and Internet Application Computer Warehouse Web Application By Team Alpha :-  Puja Mehta (102163)  Mona Nagpure (102147)

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
3 Copyright © 2005, Oracle. All rights reserved. Designing J2EE Applications.
JSP and Servelets.
CGI programming. Common Gateway Interface interface between web server and other programs (cgi scripts) information passed as environment variables passed.
Servlets, JSP and JavaBeans Joshua Scotton.  Getting Started  Servlets  JSP  JavaBeans  MVC  Conclusion.
Apache Struts Technology
Java Servlets Java Server Pages (JSP)
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
Objectives Ch. D - 1 At the end of this chapter students will: Know the general architecture and purpose of servlets Understand how to create a basic servlet.
Fundamentals, Design, and Implementation, 9/e Chapter 14 JDBC, Java Server Pages, and MySQL.
An introduction to Java Servlet Programming
18-Jun-15 JSP Java Server Pages Reference: Tutorial/Servlet-Tutorial-JSP.html.
JSP Java Server Pages Reference:
Multiple Tiers in Action
2/16/2004 Dynamic Content February 16, /16/2004 Assignments Due – Message of the Day Part 1 Due – Reading and Warmup Work on Message of the Day.
Java database Programming JDBC Trademarked name of a Java API that supports Java programs that access relational databases Stand for Java DataBase Connectivity.
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.
ECE356 – Database Systems Lab 1 – Building a Web Project with NetBeans Tiuley Alguindigue Lab Instructor – University of Waterloo, E & CE Dept. Fall 2013.
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 Life Cycle. The Servlet Life Cycle A servlet life cycle can be defined as the entire process from its creation till the destruction. The following.
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.
Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
Struts. Agenda Preface Struts and its components An example The architecture required for Struts Applications.
UNIT-V The MVC architecture and Struts Framework.
Java Server Pages B.Ramamurthy. Topics for Discussion 8/20/20152 Inheritance and Polymorphism Develop an example for inheritance and polymorphism JSP.
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
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.
Java support for WWW Babak Esfandiari (sources: Qusay Mahmoud, Roger Impey, textbook)
JSP Architecture Outline  Model 1 Architecture  Model 2 Architecture.
COMP 321 Week 7. Overview HTML and HTTP Basics Dynamic Web Content ServletsMVC Tomcat in Eclipse Demonstration Lab 7-1 Introduction.
CMPUT 391 – Database Management Systems Department of Computing Science University of Alberta CMPUT 391 Database Management Systems Web based Applications,
Servlet Lifecycle Lec 28. Servlet Life Cycle  Initialize  Service  Destroy Time.
Chapter 3 Servlet Basics. 1.Recall the Servlet Role 2.Basic Servlet Structure 3.A simple servlet that generates plain text 4.A servlet that generates.
Webcommerce Computer Networks Webcommerce by Linnea Reppa Douglas Martindale Lev Shalevich.
Java Servlets & Java Server Pages Lecture July 2013.
Java Servlets Lec 27. Creating a Simple Web Application in Tomcat.
CS 160: Software Engineering October 1 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
20-Nov-15introServlets.ppt Intro to servlets. 20-Nov-15introServlets.ppt typical web page – source Hello Hello.
S ERVLETS Hits Counter 21-Nov-15. S ERVLETS - H ITS C OUNTER Many times you would be interested in knowing total number of hits on a particular page of.
Server-side Programming The combination of –HTML –JavaScript –DOM is sometimes referred to as Dynamic HTML (DHTML) Web pages that include scripting are.
Introduction to Server-Side Web Development Introduction to Server-Side Web Development Session II: Introduction to Server-Side Web Development with Servlets.
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.
JS (Java Servlets). Internet evolution [1] The internet Internet started of as a static content dispersal and delivery mechanism, where files residing.
Advanced Java Session 6 New York University School of Continuing and Professional Studies.
CS320 Web and Internet Programming Introduction to Java Servlets Chengyu Sun California State University, Los Angeles.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
© 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.
©SoftMoore ConsultingSlide 1 Overview of Servlets and JavaServer Pages (JSP)
How CGI and Java Servlets are Run By David Stein 14 November 2006.
Web Programming Assistant Professor Xiaozhong Liu
 Java Server Pages (JSP) By Offir Golan. What is JSP?  A technology that allows for the creation of dynamically generated web pages based on HTML, XML,
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
OOSD Using Java CBTS Framework. 11/2/04CBTS2 Servlet  A servlet is a Java program that can extends Web server’s functionality.  Servlets interact with.
Apache Struts Technology A MVC Framework for Java Web Applications.
A Presentation Presentation On JSP On JSP & Online Shopping Cart Online Shopping Cart.
Speaker Name Speaker Title Speaker Title Oracle Corporation Olivier Le Diouris Principal Product Manager Oracle Corporation Building Servlet and JSP Applications.
MODEL VIEW CONTROLLER PATTERN. Model View Controller MVC is a time tested method of separating the user interface of an application from its Domain Logic.
Introduction to Servlets
Java Servlets By: Tejashri Udavant..
HTTP Servlet Overview Servlets are modules that extend request/response-oriented servers, such as Java-enabled web servers. For example, a servlet might.
Objectives In this lesson you will learn about: Need for servlets
Presentation transcript:

CS 562 Advanced Java and Internet Application Computer Warehouse Web Application By Team Alpha :-  Puja Mehta (102163)  Mona Nagpure (102147)

Table of Contents Overview Architecture Model-View-Controller Architecture JSPs Servlets JavaBeans Database (MySQL)

Overview Computer Warehouse is a web application for a fictional company that allows a user to browse through a catalog of the company’s products such as laptops, desktops and various computer accessories. The user can select products, add products to a cart and purchase them using a credit card. The web application accepts the order and displays an invoice receipt for the purchase. The web application allows the user to join an list.

Architecture HTML FilesJSP Files Other Java ClassesJavaBeansServlets Presentation Layer Business Rules Layer Database

Model-View-Controller (MVC) Pattern Controller ( DisplayProduct Servlet.class ) Database (MySQL) Model ( Product.class) Browser (Internet Explorer, Firefox) View ( Laptop.jsp ) HTTP response HTTP request

Model-View-Controller (MVC) Architecture MVC is a standard approach used to structure web applications. MVC pattern has three layers: the model, the view and the controller. Model defines business layer implemented by Javabeans. View defines presentation layer implemented by HTML and JSPs. Controller manages flow of data using Servlets.

Java Server Pages (JSP) A Java Server Page, or JSP, consists of Java code that is embedded within HTML Code. When a JSP is requested, the JSP engine translates it into a Servlet and compiles it. The Servlet is run by the servlet engine. For Java web applications Servlets are used to do the processing and JSP’s are used to present the user interface.

Servlets A Servlet is a Java class that extends the HttpServlet class and runs on a server within a servlet container. A Servlet is an object that receives a request and generates a response based on that request. Before requesting a servlet, it has to be mapped to a URL pattern using the Web.xml file.

Methods of a Servlet public void init() throws ServletException{}; public void service (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {}; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {}; public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {}; public void destroy () {};

Life cycle of a Servlet A server loads and initializes the Servlet by calling the init () method. The Servlet handles each browser request by calling the service () method. This method then calls another method to handle a specific HTTP request type. The server removes the Servlet by calling the destroy () method either when it has been idle for sometime or when server is shut down.

JavaBeans JavaBeans are classes written in the Java programming language conforming to following conventions: -  The class must have a public default constructor.  The class properties must be accessible using getter and settter methods (so-called accessor methods and mutator methods).  The class should be serializable. They are used to encapsulate many objects into a single object (the bean), so that they can be passed around as a single bean object instead of as multiple individual objects.

Database (MySQL) MySQL is an open source Database Management System (DBMS) Some of the features of MySQL are :-  Inexpensive  Fast  Easy to use  Portable  Support for SQL  Support for multiple clients

Steps to connect to a Database Load the drivers Get the connection Create the statement Execute the query Process the result set Close the connection

Steps to connect to a Database (example) String dbURL = "jdbc:mysql://localhost:3306/ClassProject"; String username = “xxx"; String password = “xxxx"; String productCode = request.getParameter("code"); Connection connection = DriverManager.getConnection(dbURL, username, password); Statement statement = connection.createStatement(); String query = "SELECT * FROM product WHERE code = '" + productCode + "'"; ResultSet rs = statement.executeQuery("SELECT * FROM classproject.product WHERE code = '" + productCode + "'");

Thank You