8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.

Slides:



Advertisements
Similar presentations
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
Advertisements

TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 22 World Wide Web and HTTP.
The Web Warrior Guide to Web Design Technologies
Chapter 31 Basic Form-Processing Techniques JavaServer Pages By Xue Bai.
Session 13 Active Server Pages (ASP) Matakuliah: M0114/Web Based Programming Tahun: 2005 Versi: 5.
Server-Side vs. Client-Side Scripting Languages
1 Chapter 12 Working With Access 2000 on the Internet.
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.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Introduction to Web Database Processing
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.
1 Active Server Pages Active Server Pages (ASPs) are Web pages ASP = server-side scripts + HTML The appearance of an Active Server Page depends on who.
Introduction to Web Interface Technology (CSE2030)
Introduction to Web Interface Technology (CSE2030)
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Session Management A290/A590, Fall /25/2014.
Tutorial 1: Introduction to JavaScript JavaScript - Introductory.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Beginning Active Server Pages Barry Sosinsky Valda Hilley Programming.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
INTRODUCTION TO WEB DATABASE PROGRAMMING
Chapter 9 Using Perl for CGI Programming. Computation is required to support sophisticated web applications Computation can be done by the server or the.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Chapter 16 The World Wide Web Chapter Goals Compare and contrast the Internet and the World Wide Web Describe general Web processing Describe several.
Server-side Scripting Powering the webs favourite services.
4-1 INTERNET DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
Chapter 16 The World Wide Web. 2 The Web An infrastructure of information combined and the network software used to access it Web page A document that.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Dynamic Action with Macromedia Dreamweaver MX Barry Sosinsky Valda Hilley.
Server Side Programming ASP1 Server Side Programming Database Integration (cont.) Internet Systems Design.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Using Visual Basic 6.0 to Create Web-Based Database Applications
5 Chapter Five Web Servers. 5 Chapter Objectives Learn about the Microsoft Personal Web Server Software Learn how to improve Web site performance Learn.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
Elements of ASP Documents Adapted from MCDN Web Workshop ( and Webmonkey’s Introduction to Active.
Section 4.1 Format HTML tags Identify HTML guidelines Section 4.2 Organize Web site files and folder Use a text editor Use HTML tags and attributes Create.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
Tutorial 10 by Sam ine1020 Introduction to Internet Engineering 1 Database & Server-side Scripting Tutorial 10.
Database-Driven Web Sites, Second Edition1 Chapter 5 WEB SERVERS.
Chapter 8 Cookies And Security JavaScript, Third Edition.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
CA Professional Web Site Development Class 2: Anatomy of a Web Site and Web Page & Intro to HTML.
Creating PHPs to Insert, Update, and Delete Data CS 320.
7 Chapter Seven Client-side Scripts. 7 Chapter Objectives Create HTML forms Learn about client-side scripting languages Create a client-side script using.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Introduction to JavaScript CS101 Introduction to Computing.
ASP. What is ASP? ASP stands for Active Server Pages ASP is a Microsoft Technology ASP is a program that runs inside IIS IIS stands for Internet Information.
Microsoft FrontPage 2003 Illustrated Complete Integrating a Database with a Web Site.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
 Previous lessons have focused on client-side scripts  Programs embedded in the page’s HTML code  Can also execute scripts on the server  Server-side.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
HTML Basics. HTML Coding HTML Hypertext markup language The code used to create web pages.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
Creating Databases applications for the Web: week 2 Basic HTML review, forms HW: Identify unique source for asp, php, Open Source, MySql, Access.
Higher Computing Science Coding the Web: HTML, JavaScript, PHP and MySQL.
7-1 Active Server and ADO Colorado Technical University IT420 Tim Peterson.
CHAPTER 7 LESSON C Creating Database Reports. Lesson C Objectives  Display image data in a report  Manually create queries and data links  Create summary.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
ASP.NET Programming with C# and SQL Server First Edition
Section 4.1 Section 4.2 Format HTML tags Identify HTML guidelines
Client side & Server side scripting
Chapter 27 WWW and HTTP.
Presentation transcript:

8 Chapter Eight Server-side Scripts

8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process form inputs using Active Server Pages Create a Web application using client- and server-side scripts

8 Server-side Scripts Server-side scripts –Scripts that are processed on the Web server, need PWS to process! –Used to create dynamic Web pages that retrieve and display database data and modify data records Active Server Pages –Microsoft-specific Web pages containing server- side scripting commands to process user inputs and create dynamic Web pages that display database data

8 Server-side Scripts Figure 8-1: Web site architecture using a server-side script

8 Active Server Pages Active Server Page (ASP) –Text file that has an.asp extension and contains server-side script commands that can perform a variety of tasks (retrieve data, update data, query data) –Usually contains HTML commands for creating a formatted Web page Netscape has a server-side scripting technology called LiveWire that is similar to Active Server Pages

8 Active Server Pages Since ASPs are processed on a Web server, ASP files must be stored and run from a folder on the Web server (page 271) –They cannot be displayed from a folder on the user’s workstation using a file URL –Programmers often store program files in folders that are named “bin” or have the word “bin” as part of the folder name

8 Active Server Pages Access privileges that are available in Personal Web Server (PWS) include: –Read, which only allows users to view HTML documents –Execute, which allows users to run Web pages that contain executable programs as well as scripts –Scripts, which allows users to run Web pages that contain scripts, but do not run Web pages that contain executable programs

8 Active Server Pages When creating an ASP, it is good practice to: –First create a static HTML Web page template file that contains all of the HTML tags and formatted text that you want to have displayed on the formatted Web page that is generated by the ASP (page 273) –Then, add the script code for the dynamic components and be certain that the page’s HTML formatting will be correct

8 ASP Commands The main difference between ASP files and HTML document files is ASP files contain ASP script code lines along with HTML commands in the Web page body –Script commands like HTML commands, can span multiple lines

8 ASP Commands The beginning and ending points of ASP script code lines are signaled by script delimiter tags –The opening script delimiter tag is an opening angle bracket and a percent sign (<%) –The closing script delimiter tag is a percent sign and a closing angle bracket (%>)

8 Displaying Database Data in an ASP To create an ADO database connection object, you must create a server object –Memory area on the Web server that stores the variables and other information needed to process the ASP Every time the ASP is executed, a new server object must be created

8 Create ASP - Overview Create ADO database connection –Create a server object(memory area on the web server that stores the variables and other info needed to process ASP) Open the database connection (ODBC connection using ODBC driver) To retrieve data from database, you create a recordset based on SQL query Display values Close database connection

8 Displaying Database Data in an ASP In the code to open an ODBC connection –You must specify the name of the server object, and use the Open method to specify that the object is to be opened –Specify the database type and database location; for an Access database, the database location is the drive letter, folder, path, and database filename

8 Displaying Database Data in an ASP Figure 8-5: Code to open an Access database connection object (open and closing script delimeter tags)

8 Displaying Database Data in an ASP When finished using a database connection object, close the database connection; this makes its resources available to other Web server processes

8 Displaying Database Data in an ASP In a Web page with server-side scripts: –All of the server-side commands enclosed in script delimiter tags are removed by the Web server when the Web page is processed –Only the finished HTML commands are sent to the user’s browser for display

8

8 Retrieving Input Parameters into an ASP To retrieve the value of a variable that is passed as a URL parameter, use the Request object –An object within an ASP that stores information that is sent from a user’s browser to the Web server The Request object has a Querystring property, which contains the name of the variable whose value will be retrieved as a URL parameter

8 Retrieving Input Parameters into an ASP It can be tricky to create SQL queries that use URL parameters - You must concatenate text strings, blank spaces, and variable values together so that the variable string is formatted correctly

8

8 Debugging ASP Scripts The common errors of forgetting to save a modified ASP file, or displaying a cached version of a previous file, apply to ASPs as well as client-side scripts When calling an ASP from another Web page and passing URL parameter values, always confirm the parameter name/value pairs are passed correctly by viewing the URL of the hyperlink that calls the ASP

8 Debugging ASP Scripts A common error in ASP scripts occurs when inadvertently omitting an opening or closing script delimiter tag Figure 8-16: Source code with omitted script delimiter tag

8 Debugging ASP Scripts When looking for causes of errors, always look at the code lines immediately before the line reported in the error message If you cannot locate the error visually, the next step is to systematically locate the code line that is causing the error In an ASP, you can track script execution by adding debugging messages

8

8 Creating Client-side Scripts in ASPs Preprocessing the ASP –Use client-side scripts within ASPs so that when the user clicks a button on an HTML form, the form runs a client-side script that is embedded within the HTML code on the ASP Creating and Retrieving Cookie Values Using a Client Side Script