Client side & Server side scripting

Slides:



Advertisements
Similar presentations
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Advertisements

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.
Server-Side vs. Client-Side Scripting Languages
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.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
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
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
1 Web Server Concepts Dr. Awad Khalil Computer Science Department AUC.
ASP.NET Dr. Ralph Westfall May, Web Development Problem HTML designed to display static pages only interactive when user clicks links  can’t provide.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
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.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 21 - Web Servers (IIS, PWS and Apache) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3.
HOW WEB SERVER WORKS? By- PUSHPENDU MONDAL RAJAT CHAUHAN RAHUL YADAV RANJIT MEENA RAHUL TYAGI.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
1 Welcome to CSC 301 Web Programming Charles Frank.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Introduction to JavaScript CS101 Introduction to Computing.
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.
WWW: an Internet application Bill Chu. © Bei-Tseng Chu Aug 2000 WWW Web and HTTP WWW web is an interconnected information servers each server maintains.
1 Web Servers (Chapter 21 – Pages( ) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3 System Architecture.
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.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
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. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
National College of Science & Information Technology.
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
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.
4.01 How Web Pages Work.
4.01 How Web Pages Work.
Web Programming Language
4.01 How Web Pages Work.
Distributed Control and Measurement via the Internet
Tonga Institute of Higher Education IT 141: Information Systems
IS1500: Introduction to Web Development
Section 6.3 Server-side Scripting
WWW and HTTP King Fahd University of Petroleum & Minerals
JavaScript and Ajax (Internet Background)
CNIT 131 Internet Basics & Beginning HTML
E-commerce | WWW World Wide Web - Concepts
E-commerce | WWW World Wide Web - Concepts
Introduction to Programming the WWW I
PHP / MySQL Introduction
Tutorial (4): HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
IS333D: MULTI-TIER APPLICATION DEVELOPMENT
The Request & Response object
Chapter 27 WWW and HTTP.
Tonga Institute of Higher Education IT 141: Information Systems
Module 1 Introduction to PHP 11/30/2018 CS346 PHP.
Web Page Concept and Design :
Static and Dynamic Web Pages
Tonga Institute of Higher Education IT 141: Information Systems
HyperText Transfer Protocol
4.01 How Web Pages Work.
Information Retrieval and Web Design
Web Servers (IIS and Apache)
4.01 How Web Pages Work.
Web Application Development Using PHP
Presentation transcript:

Client side & Server side scripting How do Web server works First, it's important to note that this is a two-sided story. Web servers are responsible for storing and exchanging information with other machines. Because of this, at least two participants are required for each exchange of information: a client, which requests the information, and a server, which stores it. Each side also requires a piece of software to negotiate the exchange of data; in the case of the client, a browser like Netscape or Internet Explorer is used.

Server data exchange A simple exchange between the client machine and Web server goes like this: 1. The client's browser dissects the URL in to a number of separate parts, including address, path name and protocol. 2. A Domain Name Server (DNS) translates the domain name the user has entered in to its IP address, a numeric combination that represents the site's true address on the Internet (a domain name is merely a "front" to make site addresses easier to remember). 3. The browser now determines which protocol (the language client machines use to communicate with servers) should be used. Examples of protocols include FTP, or File Transfer Protocol, and HTTP, Hypertext Transfer Protocol. 4. The server sends a GET request to the Web server to retrieve the address it has been given. For example, when a user types http://www.example.com/1.jpg, the browser sends a GET 1.jpg command to example.com and waits for a response. The server now responds to the browser's requests. It verifies that the given address exists, finds the necessary files, runs the appropriate scripts, exchanges cookies if necessary, and returns the results back to the browser. If it cannot locate the file, the server sends an error message to the client. 5. The browser translates the data it has been given in to HTML and displays the results to the user. This process is repeated until the client browser leaves the site.

Client side scripting Most web applications involve both client-side and server-side script. Client-side script is often used to program the user interface for an application - for example, to change a web page's text dynamically, respond to user actions such as button clicks, and perform such client-oriented tasks as input validation. Client-side script executes locally in the browser, which provides the user with a lively and responsive interface.

Client side scripting Client-side scripts are programs that you write and attach to HTML documents that run on a user's browser while he is viewing said documents. When developing ASP.NET server controls you should ask yourself how you could enhance the usability through the use of client-side script. Once you have identified these areas, all that remains is to augment the server control so that it emits the proper client-side script. There are two types of client-side script ASP.NET server controls can emit: Client-side script blocks Client-side HTML attributes

Writing client side scripts A client side script using VB script. A client side script using Java script.

Advantage & disadvantage of Client side scripting. Advantages Client-side scripts offer numerous advantages, including: Allow for more interactivity by immediately responding to users' actions. Execute quickly because they don't require a trip to the server May improve the usability of Web sites for users whose browsers support scripts. Can give developers more control over the look and behavior of their Web applications. Can be substituted with alternatives (for example, HTML) if users' browsers do not support scripts, are reusable and obtainable from many free resources such as Hotscripts.com and Javascript.com

Advantage & disadvantage of Client side scripting. Disadvantages Client-side scripts also create additional worries, including: Not all browsers support scripts, therefore, users might experience errors if no alternatives have been provided. Different browsers and browser versions support scripts differently, thus more quality assurance testing is required. More development time and effort might be required (if the scripts are not already available through other resources).

Server side script Server-side scripting is about "programming" the behavior of the server. This is called server-side scripting or server scripting. Normally when a browser requests an HTML file, the server returns the file, but if the file contains a server-side script, the script inside the HTML file is executed by the server before the file is returned to the browser as plain HTML.

Server side script What can Server Scripts Do? Dynamically edit, change or add any content to a Web page Respond to user queries or data submitted from HTML forms Access any data or databases and return the results to a browser Customize a Web page to make it more useful for individual users Provide security since your server code cannot be viewed from a browser Important: Because the scripts are executed on the server, the browser that displays the ASP/PHP file does not need to support scripting at all!

Writing server side script If we're going to place any kind of server-side script within our web page source files, then we need to label the scripts – so that the server can identify them as server-side scripts and hence arrange for them to be interpreted correctly. There are two ways to label server-side scripts: Use the <% … %> server script delimiters, which denote ASP code Use the HTML <SCRIPT> tag, specifying the RUNAT=SERVER attribute within the tag. If a tag like this is found within an .asp file, then it is treated as ASP. If such a tag is found within an .htm file, then it is treated as a non-ASP server-side script.

Using your preferred HTML editor, start a new document Using your preferred HTML editor, start a new document. Type the following code into it: <HTML> <HEAD> <TITLE>Writing the Current Date to the Page with ASP Script</TITLE> </HEAD>   <BODY BGCOLOR=GRAY> <H2>Date Confirmation</H2> <SCRIPT LANGUAGE=VBSCRIPT RUNAT=SERVER> Response.Write(Date) </SCRIPT> </BODY> </HTML> Save the file as DateConf1.asp in your Inetpub\wwwroot\BegASPFiles directory.

Getting info from user To read the values of a form field, you need to use the request object. The request object has use mainly two collections Form collections When to use QueryString When the form field values are being passed through querystring, and if you create a form with METHOD=GET, this is the request collection you’ll want to use Form When the form is created with its METHOD property set to POST, use this request collection.

Getting info from user User Input The Request object may be used to retrieve user information from forms. Form example: <form method="get" action="simpleform.asp"> First Name: <input type="text" name="fname" /> <br /> Last Name: <input type="text" name="lname" /> <br /><br /> <input type="submit" value="Submit" /> </form> User input can be retrieved in two ways: With Request.QueryString or Request.Form. Request.QueryString The Request.QueryString command is used to collect values in a form with method="get". Information sent from a form with the GET method is visible to everyone (it will be displayed in the browser's address bar) and has limits on the amount of information to send. If a user typed "Bill" and "Gates" in the form example above, the URL sent to the server would look like this: <body> Welcome <% response.write(request.querystring("fname")) response.write(" " & request.querystring("lname")) %> </body>

Using info obtained from user <html> <body> <form action="demo_reqquery.asp" method="get"> Your name: <input type="text" name="fname" size="20" /> <input type="submit" value="Submit" /> </form> <% dim fname fname=Request.QueryString("fname") If fname<>"" Then       Response.Write("Hello " & fname & "!<br />")       Response.Write("How are you today?") End If %> </body> </html>