DT228/3 Web Development Active Server Pages & IIS Web server.

Slides:



Advertisements
Similar presentations
Other Web Application Development Technologies. PHP.
Advertisements

E-Commerce CMM503 – Lecture 8 Stuart Watt Room C2.
Lecture 11 Server Side Interaction
Lecture 6/2/12. Forms and PHP The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input When dealing with HTML forms.
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
Chapter 51 Scripting With JSP Elements JavaServer Pages By Xue Bai.
DT228/3 Web Development WWW and Client server model.
Languages for Dynamic Web Documents
DT228/3 Web Development Introduction to Java Server Pages (JSP)
DT211/3 Internet Application Development Active Server Pages & IIS Web server.
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
Server-Side vs. Client-Side Scripting Languages
DT211/3 Internet Application Development JSP: Processing User input.
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
DT211/3 Internet Application Development
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 Active Server Pages
DT228/3 Web Development JSP: Directives and Scripting elements.
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
1 Java Server Pages Can web pages be created specially for each user? What part does Java play?
1 Chapter 20 — Creating Web Projects Microsoft Visual Basic.NET, Introduction to Programming.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
Course Textbook: Build Your Own ASP.Net Website: Chapter 2
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Beginning Active Server Pages Barry Sosinsky Valda Hilley Programming.
Overview of JSP Technology. The need of JSP With servlets, it is easy to – Read form data – Read HTTP request headers – Set HTTP status codes and response.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
Using Data Active Server Pages Objectives In this chapter, you will: Learn about variables and constants Explore application and session variables Learn.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
4.1 JavaScript Introduction
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
Server- Side technologies Client-side vs. Server-side scripts PHP basic ASP.NET basic ColdFusion.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Agenda Web Development Chapter 7 Review Class Discussion Issues.
Lecture Note 3: ASP Syntax.  ASP Syntax  ASP Syntax ASP Code is Browser-Independent. You cannot view the ASP source code by selecting "View source"
CIS 375—Web App Dev II ASP.NET 2 Introducing Web Forms.
Dynamic Web Sites Chris North cs3724: HCI. Presentations matt ketner, sam altman, mike gordon Vote: UI Hall of Fame/Shame?
ASP.NET Dr. Ralph Westfall May, Web Development Problem HTML designed to display static pages only interactive when user clicks links  can’t provide.
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.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
ASP.NET.. ASP.NET Environment ASP.NET is Microsoft's programming framework that enables the development of Web applications and services. It is an easy.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Website Development with PHP and MySQL Saving Data.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Introducing ASP.NET 2.0. Internet Technologies WWW Architecture Web Server Client Server Request Response Network HTTP TCP/IP PC/Mac/Unix + Browser (IE,
Dynamic web content HTTP and HTML: Berners-Lee’s Basics.
EIW - ASP Introduction1 Active Server Pages VBScript.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
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.
 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.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
ASP (COMPONENTS) Active Server Pages (cont..) 1. global.asa file The Global.asa file is an optional file that can contain declarations of objects, variables,
STRUCTURE OF JSP PRESENTED BY: SIDDHARTHA SINGH ( ) SOMYA SHRIVASTAV ( ) SONAM JINDAL ( )
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
Chapter 6 Chapter 6 Server Side Programming (JSP) Part 1 1 (IS 203) WebProgramming (IS 203) Web Programming.
How CGI and Java Servlets are Run By David Stein 14 November 2006.
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.
Java Server Pages Can web pages be created specially for each user?
JavaScript and Ajax (Ajax Tutorial)
ASP Explained By: Sarbjit Kaur.
Introduction and Principles
Client side & Server side scripting
Presentation transcript:

DT228/3 Web Development Active Server Pages & IIS Web server

Readability of ASP pages Always always always ensure that code is: INDENTED COMMENTED ID BLOCK 1)Indented - to reflect level of the code ajsdlkfjads etc 2) Well commented. Comments in ASP appear as ‘ the next subroutine will appear as… ‘ followed by a function which will calculate.. Comments in HTML appear as HTML comments will be visible by view source in browser, ASP comments won’t.

Readability of ASP pages 3) Titled: At the top of each ASP page, should have an ID block explaining who write the script, date, script name, description and any revisions. Can use either ASP or HTML comments (depending on whether clients should be able to see the ID block) <% ' ********************************************* ' *** Script name: conversion.asp *** ' *** Author: Jimmy Saville *** ‘ *** Date: July 7th 2003 *** ‘ *** Desciption: whatever it does.. *** ‘ *** Revisions: *** ‘ *** August 8th 2003: added subroutine *** '************************************************ %> etc

ASP Syntax ASP files for web output usually contain HTML tags. Any scripts intended for execution by the server must be between to distinguish them from HTML The ASP engine looks specifically for code between - this code will then be parsed by the ASP engine. The remainder will be ignored

The default language for code is VBScript, although other languages can be used e.g. JavaScript, Jscript. To set the language, use a language specification at the first line of the page using declarer: etc etc You don’t have to set the language for VBSCript as it’s the default – but it’s good practice to include it. All examples here are in VBScript ASP Scripting languages

ASP- simple example Using View Source at the browser will show HTML only. Dim used to create a variable “name” Write methods of Response object used to output ‘Option Explicit’ enforces all variables to be declared. Good practice

ASP – Declaring variables To declare a variable – use Dim e.g Dim Actors Variables are of type variant (You don’t have to explicitly state string, integer etc.) To declare an array add the array size on. e.g. Dim Actors(3) First element of the array has an index 0 e.g. Actors(0) = “Tom” Function Ubound determines the upper index of the array e.g. Ubount(Actors) has a value of 4

ASP – Declaring variables - example

ASP- Array example …. A list of the best actors in the film> <% Dim Actors(3), i Actors(0) = “Tom Cruise” Actors(1) = “Cillian Murphy” Action(2) = “Julia Roberts” For I = 0 to Ubound(Actors) OutStr = OutStr + “:” + Actors(I) + “ ” Next Response.Write(OutStr) %> etc Do not have to include the Counter variable as in VB.

ASP Object Model ASP has seven built-in objects. Each of these objects has a set of properties, methods and collections that can be used to enhance ASP pages: 1.Request (Has a “form” collection to hold data entered into a form) 2.Response (Has a “write method” to output to web page) 3.Session 4.Server 5.Application 6.ObjectContext 7.ASPError (new) Detailed info at : Data structures where number of elements is variable (unlike arrays)

ASP Object Model - Request 1.Request - supplies information regarding the request the user sends to the Web application Request objects includes the following collections: Form (values from the form elements sent by the browser). Any elements in a HTML are available to to ASP using Request.Form (elementname) IF the “post” request method has been used QueryString – values of the variables in a HTTP query string, which is data sent to the server in the URL I.e. QueryString is populated if the “get” method is used

ASP Object Model – Request – HTML Form that collects 3 pieces of info.. header etc Your name: Your favourite colour: Your favourite film: <input type = "submit" value = "Click to submit information" etc

ASP Object Model – Request – output form content onto a web page <html etc… <font color = blue size = 4 The data entered into the form was: Name = Favourite colour = Favourite Film = etc The Form collection of the Request object holds all the request parameters Note: can use a short cut to output onto the web page from a script. Instead of Response.write can just use. Both ways shown here.

Use subroutines and functions in ASP pages in order to economise on code.. I.e to enable ‘modules’ of code to be used and reused Subroutines define a series of steps that accomplishes some task, but does not usually return a value Functions accomplish a series of steps And usually return a single value ASP: Subroutines and functions

ASP : Subroutines - example <% sub calculate(num1,num2) response.write(num1*num2) end sub %> The product of the two numbers entered is: <% dim x dim y x = request.form("firstNum") y = request.form("secondNum")%> Result: etc Subroutine always starts with Sub, ends with End Sub use “Call” Arguments passed to subroutine (num1, num2)

ASP : Function example etc <% Function retailPrice(price) dim tax tax=price*.09 retailPrice =price+tax end Function %> etc.. etc <% dim y y = retailPrice(request.form("netprice")) Response.write(“The retail price includig tax " &y) %> etc Function always starts with Function and ends with End function Make sure that output is explicitly named in the function Retrieves a netprice and calculates the retail price, using the function

ASP- reusable code Very common in a web application to need to include common code such as headers/footers/navigation bars, subroutines etc across more than one Web page. ASP allows the use of a Server Side Include directive called INCLUDE, which includes the contents of another file into the current file. It’s the only SSI directive allowed in ASP (e.g. #echo, #exec etc are not allowed) Must surround the ‘ include ’ SSI directive as a HTML comment: Syntax:

ASP- reusable code - example Will include the contents of header.html into the ASP page. It assumes header.html is in subdirectory include, relative to to the current directory. Note: good practice to place all ‘include’ code into a single directory.. called include Will include the contents of header.html into the ASP page. It assumes header.html is the files virtual path relative to the server root directory. It’s not concernted with current directory.

Comparing ASP versus JSP Similarities Both are scripting based technologies Both enable dynamic web pages Both help to separate the page design from the programming logic Both provide an alternative to CGI Scripts, enabling easier and fast page development and deployment Compilation: ASP was originally interpreted but ASP.net uses compiled code, similar to JSP

Using ASP versus JSP ? For a development project, how to choose whether ASP versus JSP may be used? (assuming PHP and others have been excluded!) What technology is used already? ASP is usually used with Microsoft’s IIS, which requires Windows operating system -  tied into Microsoft technology. Whereas JSP is platform independent -  check whether the company is tied into any particular vendor products already that will guide decision> ASP JSP Web Server Microsoft IISAny web server, include apache, Netscape & IIS PlatformsMicrosoft WindowsMost popular platforms

Using ASP versus JSP ? Development skills - JSP support Javascript, Java code and tags (custom and JSLT). ASP supports both Vbscript and JavaScript. Need to check which skills are already available in the development team Simplicity? ASP was traditionally regarded as simpler to develop (VBScript) than JSP (using Java code). However, the growth in use of re-usable tag based actions for JSP is changing this. If the company is open to using JSP tags, both are relatively simple. Re-usability across platform – JSP will be portable across platforms, ASP generally is not.

Using ASP versus JSP ? Debugging/error resolution – In JSP, the code is converted into Java servlets in the background – any runtime errors refer to the servlet code which can make it difficult to find the error. ASP is not translated – so any line references are within the ASP page itself. Code re-use - Both allow common code to be taken out and re-used. JSP, with its use of custom and JSLT tags, is probably superior on this. Use of tags also enables easy global changes without individual page change. Performance – JSP traditionally considered faster as code is precompiled into servlets. However, now that ASP is part of ASP.Net which is also compiled  comparable on performance.

Using ASP versus JSP ? Open source – JSP (and other java based technologies from Sun) are developed with input from the Java community. ASP is proprietary. Cost/quality/vendor support implications.