J4www/jea Week 3 Version 2.3.2009Slide edits: nas1 Format of lecture: Assignment context: CRUD - “update details” JSP models.

Slides:



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

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Introduction to Rails.
The Librarian Web Page Carol Wolf CS396X. Create new controller  To create a new controller that can manage more than just books, type ruby script/generate.
Using JavaServer Pages Harry R. Erwin, PhD CIT304/CSE301.
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
Session 6 Server-side programming - ASP. An ASP page is an HTML page interspersed with server-side code. The.ASP extension instead of.HTM denotes server-side.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Week 2 IBS 685. Static Page Architecture The user requests the page by typing a URL in a browser The Browser requests the page from the Web Server The.
Java Server Pages Russell Beale. What are Java Server Pages? Separates content from presentation Good to use when lots of HTML to be presented to user,
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
1 Java Server Pages Can web pages be created specially for each user? What part does Java play?
Enterprise/Server-side Java Slide edited by NAS Introduction Welcome! As usual the module lasts for 12 weeks with the last.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
Java Enterprise Edition Java Web Development Structure of a web project Introduction to Web Applications The first project Introduction to Java Web Development.
UNIT-V The MVC architecture and Struts Framework.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
11 Games and Content Session 4.1. Session Overview  Show how games are made up of program code and content  Find out about the content management system.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
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.
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
Server-side Scripting Powering the webs favourite services.
About Dynamic Sites (Front End / Back End Implementations) by Janssen & Associates Affordable Website Solutions for Individuals and Small Businesses.
® IBM Software Group © 2009 IBM Corporation Rational Publishing Engine RQM Multi Level Report Tutorial David Rennie, IBM Rational Services A/NZ
Model View Controller (MVC) Rick Mercer with a wide variety of others 1.
Jonathan Westlake, ed: Nic Shulver JSP, Structure and JavaBeans JSP models Assignment context “Register as a member of the site/show member details/update.
FUNCTIONS AND STORED PROCEDURES & FUNCTIONS AND PROTECTING A DB AND PHP (Chapters 9, 15, 18)
JSP Architecture Outline  Model 1 Architecture  Model 2 Architecture.
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,
 Embeds Java code  In HTML tags  When used well  Simple way to generate dynamic web-pages  When misused (complex embedded Java)  Terribly messy.
DSpace UI Alexey Maslov. DSpace in general A digital library tool useful for storage, maintenance, and retrieval of digital documents Two types of interaction:
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
® IBM Software Group © 2007 IBM Corporation J2EE Web Component Introduction
UNIT 9.2: Learning Objectives Agile Development – Bruce Feiler on Agile Programming Database access from code – Database Cycle Review – SQL Command Types.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
JAVA SERVER PAGES. 2 SERVLETS The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
Chapter 2 An Overview of Servlet and JSP Technology.
Server-side Programming The combination of –HTML –JavaScript –DOM is sometimes referred to as Dynamic HTML (DHTML) Web pages that include scripting are.
Creating a Web Site Review of Concepts. Templates Templates are special HTML files that are used to quickly create pages on a web site. They contain the.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
Microsoft FrontPage 2003 Illustrated Complete Integrating a Database with a Web Site.
OOSSE Week 8 JSP models Format of lecture: Assignment context JSP models JSPs calling other JSPs i.e. breaking up work Parameter passing JSPs with Add.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
® IBM Software Group © 2006 IBM Corporation JSF Rich Text Area Component This Learning Module describes the use of the JSF Rich Text Area component – for.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
OOSSE Week 7 Java Server Pages Format of lecture: Introduction What are Java Server Pages? (JSPs) What do you need to run JSPs? Demo of an example of a.
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. 2 Servlets The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components.
Module 10: Data Access in ASP.NET. Overview Overview of the ASP.NET Data Access What is Data Access List of Data Source Control What is Data Bound How.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
World Wide Web has been created to share the text document across the world. In static web pages the requesting user has no ability to interact with the.
Preface IIntroduction Course Objectives I-2 Course Content I-3 1Introduction to Oracle Reports Developer Objectives 1-2 Business Intelligence 1-3 Enterprise.
A Presentation Presentation On JSP On JSP & Online Shopping Cart Online Shopping Cart.
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
Data Virtualization Community Edition
PHP / MySQL Introduction
Intro to PHP & Variables
MVC Framework, in general.
Lecture 1: Multi-tier Architecture Overview
Server-Side Processing II
Presentation transcript:

j4www/jea Week 3 Version Slide edits: nas1 Format of lecture: Assignment context: CRUD - “update details” JSP models Multiple JSPs to handle a request. JSPs calling other JSPs i.e. breaking up work JSPs with Update SQL examples Designing for JSPs Summary JSP models

j4www/jea Week 3 Version Slide edits: nas1 Multiple JSPs Last week we introduced the two forms of the include tag. Action - for dynamic content (although it can handle static content too) Directive - for static content For this module we are particularly interested in the dynamic capabilities of the include action tag The directive version is still useful, but it is not as powerful

j4www/jea Week 3 Version Slide edits: nas1 Include directive in an JSP Including Text From Another File Welcome Open Day Students Hope You Enjoy The Day

j4www/jea Week 3 Version Slide edits: nas1 Include directive result

j4www/jea Week 3 Version Slide edits: nas1 Include action – very useful Why are we more interested in the action tag? The directive version is only used for static documents like template JSP, HTML or images. The include action treats the included file as a dynamic document - it includes the output of the included file instead of including the code – this is interesting! We can now think about JSPs working together – the web engineering concept of modular code or referred to as component software.

j4www/jea Week 3 Version Slide edits: nas1 The include action - why? Spreads out the work of an application (design implication – see later slides). The example we will now show illustrates this: It contains an HTML form for user entry of requests passes them on to a primary JSP which is responsible for the request and generating the response the primary JSP uses the values received from the HTML form to select the appropriate “worker” JSP to run (two JSPs we have already seen). The model is depicted on the next slide.

j4www/jea Week 3 Version Slide edits: nas1 Include action model Primary JSP JSPs Client Request and Response DATABASE Include model The JSP parses the input from the HTML form and includes the appropriate JSP to service the client request The included JSPs are translated into their Servlet code, compiled and then executed - it is the output of that execution that is inserted into the output of the primary JSP HTTP Server - Tomcat HTML Form SQL

Using Guestbook Data HTML form with multiple JSPs to run <FORM NAME="DataSelection" ACTION=" etc:8080/includeguestbookexample.jsp" METHOD="POST"> List JSP Get JSP Call to the Primary JSP important

example of the include action - used to include the output of another JSP <% Enumeration params = request.getParameterNames(); while (params.hasMoreElements()) { String inputName = (String)params.nextElement(); String inputValue = request.getParameter(inputName); if (inputValue.equals("list")) { System.out.println('\n' + inputValue); //output the value %> <% } else if (inputValue.equals("search")){ %> <% } // end else clause } // end while loop %> Worker JSP includeguestbookexample.jsp

j4www/jea Week 3 Version Slide edits: nas1 So…… The primary JSP includes the “output” of other “worker” JSPs In this example a sort of menu has been achieved It is the primary JSP’s role to accept the request from the user and generate a response to the user which can be done by using the include action There is no limit to the number of JSPs which can be used - nice scalable solution - separating out work! - if a new feature/menu item is needed - just add another JSP There are some issues about the work organisation however and we will discuss this later in the module when we look at the MVC concept

j4www/jea Week 3 Version Slide edits: nas1 The update problem How to tackle this problem? What do we need to do? Design some steps Understand the SQL we can use Solution using the Guests example We need to: Allow the user to select a guest record Let the user view it Allow the user to modify it and then write it back to the database i.e. update it Are there any aspects we don’t wish to allow the user to do? Yes – they cannot alter the primary key

j4www/jea Week 3 Version Slide edits: nas1 The update solution So…….we need ….. A form that can call a jsp which simply displays the result from the fetch in a set of text boxes rather than a table format – this allow the user to do something with the data (those who are new to HTML will need to think about this) We can then allow the user to: change the content of the text box for firstname and then call a jsp to do the update to the database and then call another jsp to display the confirmation or return to our starting point

j4www/jea Week 3 Version Slide edits: nas1 UPDATE SQL A JSP which can use the parameters from the update form and call a JSP to update the database Use the Update SQL command

j4www/jea Week 3 Version Slide edits: nas1 Demo of update Now follows We have put the code in a zip file linked into the schedule Copy the HTML, 2 JSPs and a DB into your folder and modify the connection string to the access the database Let us run it and then have a look at the code

j4www/jea Week 3 Version Slide edits: nas1 Assignment context You can use the same approach to modify and update something in the database For example an FAQ... You now have from the opening 3 weeks of the module How to CRU How to add (create) something How to view something (retrieve) How to change something (update)

j4www/jea Week 3 Version Slide edits: nas1 Summary You have seen an update example This type of web design starts to look like a service oriented architecture (SOA), JSPs that will service other JSPs or HTML forms given the appropriate information