Component-Based Software Engineering Internet Applications Paul Krause.

Slides:



Advertisements
Similar presentations
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Advertisements

Java Script Session1 INTRODUCTION.
DT228/3 Web Development WWW and Client server model.
Using JavaServer Pages Harry R. Erwin, PhD CIT304/CSE301.
Web applications using JavaServer Faces (JSF) A brief introduction 1JavaServer Faces (JSF)
DT211/3 Internet Application Development JSP: Processing User input.
JSP: JavaServer Pages Juan Cruz Kevin Hessels Ian Moon.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
Dynamic Web Pages Bert Wachsmuth. Review  Internet, IP addresses, ports, client-server, http, smtp  HTML, XHTML, XML  Style Sheets, external, internal,
Application Architectures Vijayan Sugumaran Department of DIS Oakland University.
1 Java Server Pages Can web pages be created specially for each user? What part does Java play?
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
JavaScript Demo Presented by … Jaisingh Sumit jain Sudhindra Taran Deep arora.
UNIT-V The MVC architecture and Struts Framework.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Server Side Scripting Norman White. Where do we do processing? Client side – Javascript (embed code in html) – Java applets (send java program to run.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
11. Java-Based Web: JSP, JSF. 2 Motto: Rule 1: Our client is always right Rule 2: If you think our client is wrong, see Rule 1. - Anonymous.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
Dynamic Web Sites Chris North cs3724: HCI. Presentations matt ketner, sam altman, mike gordon Vote: UI Hall of Fame/Shame?
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
JSP Java Server Pages Softsmith Infotech.
Internet Software Development Applets Paul J Krause.
Java Server Pages Lecture July Java Server Pages Java Server Pages (JSPs) provide a way to separate the generation of dynamic content (java)
CSCI 6962: Server-side Design and Programming Introduction to Java Server Faces.
Java Server Pages A JSP page is a text-based document that contains two types of text: static template data, which can be expressed in any text-based format,
Chapter 8 Script-free pages. Problem with scripting in JSP When you use scripting (declaration, scriplet, expressions) in your JSP, you actually put Java.
Web applications using JavaServer Faces (JSF) A brief introduction 1JavaServer Faces (JSF)
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
® IBM Software Group © 2007 IBM Corporation JSP Expression Language
Lecturer: Prof. Piero Fraternali, Teaching Assistant: Alessandro Bozzon, Advanced Web Technologies: Struts–
JAVA SERVER PAGES CREATING DYNAMIC WEB PAGES USING JAVA James Faeldon CS 119 Enterprise Systems Programming.
Introduction to JavaServer Pages. 2 JSP and Servlet Limitations of servlet  It’s inaccessible to non-programmers JSP is a complement to servlet  focuses.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
1 Welcome to CSC 301 Web Programming Charles Frank.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Web Programming Brian Toone 8/27/2014. Outline for today 1.Understanding the architecture of the web 2.Overview of programming languages – Client-side.
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
Active Server Pages Server-Side Scripting and Client-Side Scripting.
Overview of Form and Javascript fundamentals. Brief matching exercise 1. This is the software that allows a user to access and view HTML documents 2.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
JSP BASICS AND ARCHITECTURE. Goals of JSP Simplify Creation of dynamic pages. Separate Dynamic and Static content.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 1COMP9321, 15s2, Week.
1) PHP – Personal Home Page Scripting Language 2) JavaScript.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 21 Java Servlets Wed. 11/22/00 based on material.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
JAVA SERVER PAGES -by Rubeena Memon Deepti Jain Jaya Thakar Jisha Vettuventra.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Chapter 14 Using JavaBeans Components in JSP Documents.
CGS 3066: Web Programming and Design Spring 2016 Introduction to JavaScript.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
A Presentation Presentation On JSP On JSP & Online Shopping Cart Online Shopping Cart.
A S P. Outline  The introduction of ASP  Why we choose ASP  How ASP works  Basic syntax rule of ASP  ASP’S object model  Limitations of ASP  Summary.
Introduction to Server-Side Web Development Introduction to Server-Side Web Development Introduction to Server-Side Web JavaBeans; basic concepts and syntax.
Introduction to.
CGS 3066: Web Programming and Design Spring 2017
Java Servlets By: Tejashri Udavant..
Scripted Page Web App Development (Java Server Pages)
Donna J. Kain, Clarkson University
Tutorial 10: Programming with javascript
A Brief History January 1996: first official release JDK 1.0
Presentation transcript:

Component-Based Software Engineering Internet Applications Paul Krause

Lecture 8 - Internet Applications Contents  Reminder of Client-Server architectures  Client-side programming with Applets and JavaScript  Server-side programming with JSP and Servlets

Client/server Architecture Server Client Internet Browser, Applets, … Client Internet Browser, Applets, … Database, servlets, …

Generic 5-tier Architecture Client Tier Presentation Business Rules Integration Resources

Application Components  Web pages HTML + scripting language code HTML + scripting language code Provides dynamic processing of data and modification of visual appearance Provides dynamic processing of data and modification of visual appearance  Program components Perform the main computations Perform the main computations Receive input from HTML forms Receive input from HTML forms Present output as web-pages Present output as web-pages  Configuration files Enables application to be quickly deployed on different servers Enables application to be quickly deployed on different servers

Types of Program Component  Controller components e.g. selection and customisation of the web-pages to return to the client e.g. selection and customisation of the web-pages to return to the client  Session beans encapsulate information and operations specific to a client session encapsulate information and operations specific to a client session stateless session beans - e.g. check data entrystateless session beans - e.g. check data entry stateful session beans - e.g. shopping cartstateful session beans - e.g. shopping cart  Entity beans provide access to persistent data provide access to persistent data

A statefull session bean public class BasketBean { private HashMap contents = new HashMap; public void addItem(Long itemid) { … } public void updateItem(Long itemid, int quantity) { … } public Set getItems( ) { … } public int getQuantity(Long itemid) { … } public void deleteItem(Long itemid) { … } public int numberOfItems( ) { … } }

Internet Programming in Java  Java-based technologies include:  Client-side: Applets Applets JavaScript JavaScript  Server-side: JSP - Java Server Pages JSP - Java Server Pages Java Servlets Java Servlets

Lecture 8 - Internet Applications Contents  Reminder of Client-Server architectures  Client-side programming with Applets and JavaScript  Server-side programming with JSP and Servlets

HelloFromVenus.java import java.awt.*; import java.applet.Applet; // Copyright (c) , Xiaoping Jia. public class HelloFromVenus extends Applet { public void paint(Graphics g) { public void paint(Graphics g) { Dimension d = getSize(); g.setColor(Color.black);g.fillRect(0,0,d.width,d.height); g.setFont(new Font("Helvetica", Font.BOLD, 24)); g.setColor(new Color(255, 215, 0)); // gold color g.drawString("Hello From Venus!", 40, 25); g.drawImage(getImage(getCodeBase(), "Venus.gif"), 20, 60, this); 20, 60, this); }}

Invoking the Applet <HTML><HEAD> Object-Oriented Software Development Using Java | HelloFromVenus Applet Object-Oriented Software Development Using Java | HelloFromVenus Applet </HEAD> <CENTER> Here is the Hello From Venus Applet Here is the Hello From Venus Applet </CENTER> Venus photo courtesy of NASA. </BODY></HTML>

JavaScript  Notation is close to Java, although with some important differences no explicit types for variables no explicit types for variables simplified structure to the code - a “scripting language” simplified structure to the code - a “scripting language”  But provides a powerful client-side processing and scripting language  Following examples from Lano et al, Software Design Using Java 2

<HTML><HEAD> Date Check Program Date Check Program // Some Java-like processing stuff goes in here // … </SCRIPT></HEAD><BODY> Click Refresh or Reload to run script again </BODY></HTML>

var firstNumber, secondNumber, number1, number2; firstNumber = window.prompt("Enter month (1--12)", "1"); secondNumber = window.prompt("Enter day (1--31)", "1"); number1 = parseInt(firstNumber); number2 = parseInt(secondNumber); if (1 <= number2 && number2 <= 31 && (number1 == 1 || number1 == 3 || number1 == 5 || number1 == 7 || number1 == 8 || number1 == 10 || number1 == 7 || number1 == 8 || number1 == 10 || number1 == 12)) number1 == 12)) { document.writeln(" Date is correct "); } else if (1 <= number2 && number2 <= 30 && (number1 == 4 || number1 == 6 || number1 == 9 || number1 == 11 )) (number1 == 4 || number1 == 6 || number1 == 9 || number1 == 11 )) { document.writeln(" Date is correct "); } else if (1 <= number2 && number2 <= 29 && number1 == 2 ) { document.writeln(" Date is correct "); } else { document.writeln(" Date is not correct! "); }

Browser Events Event HTML Syntax Page is loaded Button is pressed <INPUTTYPE = “button” VALUE = “command” ONCLICK = “function( )”> Mouse is moved Mouse over element Form entry active

Lecture 8 - Internet Applications Contents  Reminder of Client-Server architectures  Client-side programming with Applets and JavaScript  Server-side programming with JSP and Servlets

JavaServer Pages (JSP)  Works on the Server side to add functionality to HTML pages  Typically, JSP is used to add more complex functionality than JavaScript  JSP has a much closer relationship with Java Beans: Beans can be invoked from within JSP files Beans can be invoked from within JSP files Indeed, this is recommended to separate the GUI (html) from back-end code (Beans) Indeed, this is recommended to separate the GUI (html) from back-end code (Beans)

What does being a Bean mean?  In this context it is simply an instance of a Java class, conforming to an agreed pattern: The class has a no argument constructor The class has a no argument constructor Properties are accessed through “get” methods (“is” methods in the case of booleans) Properties are accessed through “get” methods (“is” methods in the case of booleans) Properties are updated through “set” methods Properties are updated through “set” methods  A JSP file then knows how to interface to it

A Booking Bean public class BookingBean { private int month; private int day; private String name; private String number; private boolean smoking: public BookingBean( ) { } // no argument constructor public void setMonth(String mon) {month = Integer.parseInt(mon); } public String getMonth( ) {return “ “ + month;} …

Using a Bean in JSP  Within a Java Server Page, we may wish to update and read a particular instance of the BookingBean class.  There is a simple mapping from lines in a JSP script, and the equivalent Java statements  This mapping is enabled by usage of the Java Bean coding guidelines

Creating and updating a Bean Corresponds to the Java statement: BookingBean booker = new BookingBean( ); Corresponds to the Java statement: booker.setMonth(request.getParameter(“month”)); Note, in this last case request is a Java object representing an HTTP request

Example jsp file <jsp : setProperty name = “booker” property = “month” param = “month”/> name = “booker” property = “month” param = “month”/> <jsp : setProperty name = “booker” property = “day” param = “day”/> name = “booker” property = “day” param = “day”/> // … <HTML> Echo Parameters Echo Parameters <BODY> Thank you, <jsp:getProperty name = “booker” property = “name” /> for your booking. You requested …

Java Servlets  Servlets use Java packages for server side processing of internet applications  This is a pure Java approach, rather than the hybrid Java/HTML approach of JSP  Can therefore write better structured, and easier to debug applications

Summary  A quick survey of Java technologies for Internet Applications  We saw the different needs of: client-side programming - relatively light-weight processes for data validation and gui configuration client-side programming - relatively light-weight processes for data validation and gui configuration server-side programming - more computationally intensive applications with access to persistent data sources server-side programming - more computationally intensive applications with access to persistent data sources  Structure these applications using ideas from Software Components to avoid a serious mess!