CS 160: Software Engineering September 3 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak www.cs.sjsu.edu/~mak.

Slides:



Advertisements
Similar presentations
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
Advertisements

The System and Software Development Process Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
CS 160: Software Engineering September 8 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
J.Sant Servlets Joseph Sant Sheridan Institute of Technology.
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.
18-Jun-15 JSP Java Server Pages Reference: Tutorial/Servlet-Tutorial-JSP.html.
JSP Java Server Pages Reference:
27-Jun-15 Directories and DDs. 2 Web apps A web application is basically a web site that: “Knows who you are”--it doesn’t just give you static pages,
Comp2513 Java Servlet Basics Daniel L. Silver, Ph.D.
Software Development Models: Waterfall and Spiral Sung Hee Park Department of Mathematics and Computer Science Virginia State University August 21, 2012.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
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.
CS 160: Software Engineering August 27 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
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. Our Project 3-tier application Develop our own multi-threaded server Socket level communication.
SE-2840 Dr. Mark L. Hornick1 Java Servlet-based web apps Servlet Architecture.
Java Servlets and JSP.
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 2.0 an Overview ( )
CS 235: User Interface Design August 27 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
CS 235: User Interface Design August 27 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
Java Server Pages B.Ramamurthy. Topics for Discussion 8/20/20152 Inheritance and Polymorphism Develop an example for inheritance and polymorphism JSP.
CS 151: Object-Oriented Design September 3 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron Mak
CS 160: Software Engineering October 8 Class Meeting
Servlets. - Java technology for Common Gateway Interface (CGI) programming. - It is a Java class that dynamically extends the function of a web server.
Java support for WWW Babak Esfandiari (sources: Qusay Mahmoud, Roger Impey, textbook)
CS 160: Software Engineering September 10 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
111 Java Servlets Dynamic Web Pages (Program Files) Servlets versus Java Server Pages Implementing Servlets Example: F15 Warranty Registration Tomcat Configuration.
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,
Web Server Programming 1. Nuts and Bolts. Premises of Course Provides general introduction, no in-depth training Assumes some HTML knowledge Assumes some.
Introduction To System Analysis and Design
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.
Java Servlets Lec 27. Creating a Simple Web Application in Tomcat.
L6-S1 UML Overview 2003 SJSU -- CmpE Advanced Object-Oriented Analysis & Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College.
CS 235: User Interface Design September 3 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
20-Nov-15introServlets.ppt Intro to servlets. 20-Nov-15introServlets.ppt typical web page – source Hello Hello.
A seminar on j2ee by saritha. s. What is J2EE J2EE (Java 2 Platform, Enterprise Edition) is a Java platform designed for the mainframe-scale computing.
Java Servlets and Java Server Pages Norman White Stern School of Business.
CS 151: Object-Oriented Design August 29 Class Meeting Department of Computer Science San Jose State University Spring 2012 Instructor: Ron Mak
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.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
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.
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
ClaRA web services V. Gyurjyan Clas12 Software Meeting
How CGI and Java Servlets are Run By David Stein 14 November 2006.
 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.
CS 160 and CMPE/SE 131 Software Engineering February 18 Class Meeting Department of Computer Science Department of Computer Engineering San José State.
S ERVLETS Form Data 19-Mar-16. F ORM P ROCESSING You must have come across many situations when you need to pass some information from your browser to.
CS 562 Advanced Java and Internet Application Computer Warehouse Web Application By Team Alpha :-  Puja Mehta (102163)  Mona Nagpure (102147)
Java Servlets References: Karen Anewalt, Mary Washington College.
CMPE 280 Web UI Design and Development August 29 Class Meeting
Servlet Fudamentals.
Java Servlets By: Tejashri Udavant..
Introduction to Software Engineering
Introduction To System Analysis and Design PART 2
Objectives In this lesson you will learn about: Need for servlets
J2EE Lecture 1:Servlet and JSP
CMPE/SE 131 Software Engineering February 16 Class Meeting
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Directories and DDs 25-Apr-19.
Directories and DDs 21-Jul-19.
Java Chapter 7 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

CS 160: Software Engineering September 3 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 2 First Page: HTML Murach's Java Servlets and JSP Join our list To join our list, enter your name and address below. Then, click on the Submit button. First name: Last name: address: User input Static page!

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 3 Dynamic Response Page Dynamically generated content!

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak What is a Servlet?  A servlet is a Java class that extends HttpServlet.  Servlets reside on the server computer in a directory that is controlled by Tomcat. Recall that Tomcat is our JSP/servlet engine.  A servlet object is invoked by a URL. URL = Uniform Resource Locator (i.e., a web address)  Servlet objects run on the server computer. _ 4

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak What is a Servlet? cont’d  When invoked, a servlet object can: Dynamically generate HTML that will be returned to the client as part of an HTTP response. Perform any application logic. Access the back-end database. Whatever – it’s Java code! _ 5

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 6 Response Page as a Servlet package ; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import business.User; import data.UserIO; public class AddTo ListServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Get parameters from the request. String firstName = request.getParameter("fName"); String lastName = request.getParameter("lName"); String Address = request.getParameter("eAddress"); Get the data for the dynamically generated content.

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 7 Response Page as a Servlet, cont’d // Send response to browser. response.setContentType("text/html;charset=UTF-8"); out.println( " \n" + " \n" + " Murach's Java Servlets and JSP \n" + " \n" + " Thanks for joining our list \n" + " Here is the information that you entered: \n" + " \n" + " First name: \n" + " " + firstName + " \n" + " \n" + " Last name: \n" + " " + lastName + " \n" + " \n" + " address: \n" + " " + Address + " \n" + " \n"

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 8 Response Page as a Servlet, cont’d + " To enter another address, click on the Back \n" + "button in your browser or the Return button shown \n" + "below. \n" + "<form action=\"join_ _list.html\" " + " method=\"post\">\n" + " \n" + " \n"); out.close(); } protected void doGet( HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } In this example, method doGet() simply calls method doPost() and passes the request and response parameters.

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 9 What is a JavaServer Page (JSP)?  A JSP is a file that looks a lot like the HTML that the web server will return to the client as part of an HTTP response. JSPs reside on the server computer in a directory that is controlled by Tomcat.  Special tags in the file represent where dynamically-generated content will appear. A plain HTML page is static. A JSP represents an HTML page that is dynamically generated.

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 10 What is a JavaServer Page? cont’d  A JSP is invoked by a URL.  The first time it’s invoked, a JSP is compiled by the JSP/servlet engine (e.g., Tomcat) into a servlet.  A JSP is a much easier way to code a servlet whose main purpose is to return HTML to the client. JSPs are often coded by web page designers who know HTML but not Java. _

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 11 Response Page as a JSP <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " Murach's Java Servlets and JSP <% // Get parameters from the request. String firstName = request.getParameter("fName"); String lastName = request.getParameter("lName"); String Address = request.getParameter("eAddress"); %> Get the data for the dynamically generated content.

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 12 Response Page as a JSP, cont’d Thanks for joining our list Here is the information that you entered: First name: Last name: address:

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 13 Response Page as a JSP, cont’d To enter another address, click on the Back button in your browser or the Return button shown below. The first time this JSP is invoked, Tomcat will compile it into a servlet that is similar to the one you saw earlier.

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 14 Unified Modeling Language (UML)  A standardized diagramming notation.  Model the structure and behavior of systems.  system = a set of interacting components Physical, conceptual, or software components. The system can be complex.  model = an abstraction of a system Deal with complexity by leaving out irrelevant details. Model object-oriented software systems. Model real-world systems. _

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 15 Unified Modeling Language (UML)  Different types of UML diagrams Class diagrams Object diagrams Activity diagrams Use case diagrams Sequence diagrams and others...

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 16 UML Class Diagram Example #1 Organization Team Member (Participant) * * “contains” “consists of” “0, 1, or more” (multiplicity) class Team-Based Organization

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 17 UML Class Diagram Example #2 Project Phase (Activity) * Demo Review Member Time Equipment Specification Design Plan Code * Artifact produces Resources * consumes Task * Presentation presents * “subclass of”

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 18 Project Phases  Requirements elicitation  Design  Implementation  Testing  Deployment  Maintenance  How do we accomplish these phases? _

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 19 Ye Olde Waterfall Model Requirements DesignImplementation Testing

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 20 The Waterfall Model, cont’d  Make sure each phase is 100% complete and absolutely correct before proceeding to the next phase.  Big Design Up Front (BDUF) Set requirements in stone before starting the design. Otherwise, you might waste design work on “incorrect” requirements. Spend extra time at the beginning to make sure that the requirements and design are absolutely correct. Source: Wikipedia article on “Waterfall Model”

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 21 The Waterfall Model, cont’d  The waterfall model has been mostly discredited. It doesn’t work! But it’s still commonly practiced. Requirements Design Implementation Testing

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 22 The Agile Manifesto for Software Development We are uncovering better ways of developing software by doing it and helping others do it. Through this work we have come to value: Individuals and interactions over processes and tools Working software over comprehensive documentation Customer collaboration over contract negotiation Responding to change over following a plan That is, while there is value in the items on the right, we value the items on the left more. Source:

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 23 Agile Software Development  Iterative and incremental development.  Each iteration is a “mini waterfall”: plan (with new requirements) refine design add new code unit and integration testing  Iterations are short: weeks rather than months. _ Requirements Design Implementation Testing

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 24 Agile Software Development  The initial iteration produces a conceptual design and a prototype.  Subsequent iterations refine the design and incrementally build the actual product.  Each subsequent iteration may also include a prototype that is quickly produced (rapid prototyping). _

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 25 Agile Software Development, cont’d  The initial iteration Prototyping and iterative development are the foundation for Rapid Application Development (RAD) tools.  Agile methodologies range from Extreme Programming (XP) to the Rational Unified Process (RUP). _

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 26 Project Phases, cont’d

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 27 Project Phases, cont’d  Development is a series of iterations.  Each iteration is a “mini waterfall” consisting of design, code (implementation), and test.  Extreme programmers say: design, test, code

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 28 Requirements Elicitation  Requires communication among the developers, clients, and users.  Clients can validate the requirements.  Creates a contract between the client and the developers.  Result: a Functional Specification that the clients can understand. _

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 29 Functional Requirements  What the system shall be able to do or allow users to do. “The phone shall use GPS to determine the wearer’s location.” “Users shall be able to choose either Option A or Option B.”  Describe the interactions between the system and its environment independent of its implementation. _

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 30 Nonfunctional Requirements  Usability, reliability, performance, supportability, etc. “The system must respond to the user within 15 seconds.” “The system shall run on Windows and Linux servers.” “The new GUI must resemble the existing GUI.”  Constraints that the system must meet. _

Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 31 Bridging the Gap  Clients and users Have a general idea of what the system should do. Have little experience with software development. Are experts in their domain.  Software developers May have little knowledge of the application domain. Have experience with software technology. Are geeks with poor social skills. _