Скачать презентацию Active Server Page — ASP in Java Script Скачать презентацию Active Server Page — ASP in Java Script

129e2051e253f6ddfa74d44d0fadc48e.ppt

  • Количество слайдов: 59

Active Server Page - ASP in Java. Script 王金龍、陳彥錚 銘傳大學 資管系 Active Server Page - ASP in Java. Script 王金龍、陳彥錚 銘傳大學 資管系

Content u Introduction u Object Models u Request Object u Response Object u Server Content u Introduction u Object Models u Request Object u Response Object u Server Object u Application and Session Objects u Installable Components for ASP

Introduction u Microsoft’s newest server-based technology for building dynamic interactive web pages u No Introduction u Microsoft’s newest server-based technology for building dynamic interactive web pages u No compiler u Text editor u Browser independent u Object-oriented u Compatible to any Active. X scripting u Transparent to users

ASP Usage <%@language=JScript%> <html> <head> <title>Active Server Scripting</title> </head> <body> <h 3>Active Server Scripting ASP Usage <%@language=JScript%> Active Server Scripting Active Server Scripting <% Response. Write("This is so cool!!!”)%>

Complete ASP Program <%@Language=JScript %> <HTML><HEAD> …</HEAD><BODY> <% … ASP script which runs on Complete ASP Program <%@Language=JScript %> … <% … ASP script which runs on the server … %>

<% … %>

Server-side includes u <!-- #include file=“include. txt” --> u Include text files in pages Server-side includes u u Include text files in pages u Virtual file addresses u u Physical u u

Top
Next
Previous

" src="https://present5.com/presentation/129e2051e253f6ddfa74d44d0fadc48e/image-7.jpg" alt=" Top
Next
Previous

" /> Top
Next
Previous

Form Use [an error occurred while processing the directive] <% Response. Write(Request. Form("text 1")); %>

Basic Statements u <% Response. Write(“string”) %> u Output u <% a string ( Basic Statements u <% Response. Write(“string”) %> u Output u <% a string ( more readable ) = “string” %> or <%=Var. Expression%> u Insert a string u <%=Request. Form(“user. Name”)%> u <% Response. Redirect(“URL”) %> u Redirect to the URL u <% // Some Comments %>

An ASP Example <%@language=JScript%> <% num=Request. Form( An ASP Example <%@language=JScript%> <% num=Request. Form("num. Of. Hr"); msg="Welcome to My ASP Example!"; %> An ASP Example You are <%=Request. Form("user. Name")%>! <%=msg%>


<% for ( i=1; i<=num; i++) { %> Iteration <%=i%> <% Response. Write("
"); } %>

Please input" src="https://present5.com/presentation/129e2051e253f6ddfa74d44d0fadc48e/image-10.jpg" alt="asp. Example 1. html Please input" /> asp. Example 1. html Please input a number: Your Name:

Source File in Web Client <html> <head><title>An ASP Example</title></head> <body> You are <b>Yen-Cheng Chen</b>! Source File in Web Client An ASP Example You are Yen-Cheng Chen! Welcome to My ASP Example!


Iteration
Iteration
Iteration
Iteration
Iteration
1
2
3
4
5

Built-In ASP Objects u Request Object u To retrieve the values that the client Built-In ASP Objects u Request Object u To retrieve the values that the client browser passed to the server during an HTTP request. u Response u To Object send output to the client. u Server u Provide utility functions on the server.

Built-In ASP Objects (cont. ) u Application u To share information among all users Built-In ASP Objects (cont. ) u Application u To share information among all users of a given application. (Like global variables) u Session u To store information needed for a particular user-session. (Like local variables) u Object. Context u To commit or abort a transaction, managed by Microsoft Transaction Server (MTS).

Client Request Object Collection: Form Query. String Server. Variables Cookie Client. Certificate Response Object Client Request Object Collection: Form Query. String Server. Variables Cookie Client. Certificate Response Object Collection: Cookie (Properties) (methods) Server Object (method) Application Object Session Object (properties) (methods)

Request Object u Provide all the information about the user’s request to applications u Request Object u Provide all the information about the user’s request to applications u Collection u. A data store that can store values by linking each one to a unique key

Collections in Request Object u Five collections u Query. String: HTTP query string (GET) Collections in Request Object u Five collections u Query. String: HTTP query string (GET) Query. String u Form: Form elements (POST) Form u Server. Variables: HTTP and environment Server. Variables variables u Cookie: Cookie sent from the browser Cookie u Client. Certificate: Certificate values (SSL: https) Client. Certificate u Usage variable = Request. collection. Name(“key”)

Properties and Methods u Properties u Total. Bytes: Read-only. Specifies the total number of Properties and Methods u Properties u Total. Bytes: Read-only. Specifies the total number of bytes the client is sending in the body of the request. u Methods u Binary. Read(count): Retrieves data sent to the server from the client as part of a POST request.

Query. String Collection: Get u The names and values of form are put into Query. String Collection: Get u The names and values of form are put into a query string u The amount of data can be sent is limited to around 1000 characters u Usage u variable = Request. Query. String(“name”)

query. Test. asp? name=Mickey+Mouse&age=50 <%@language=JScript%> <html><head><title>Query String Test ASP</title></head><body> You are <font color=red><%=Request. Query. query. Test. asp? name=Mickey+Mouse&age=50 <%@language=JScript%> Query String Test ASP You are <%=Request. Query. String("name")%> You are <%=Request. Query. String("age")%> years old.

<HTML><HEAD><TITLE></HEAD><BODY> <H 3>Passing Name=Value Pairs with a Query String</H 3> <A NAME= </HEAD><BODY> <H 3>Passing Name=Value Pairs with a Query String</H 3> <A NAME="product" HREF="list 7_5. asp? name=dina&pub=sams">Sams Publishing </A></BODY></HTML> <html> <head> <title> Getting Name=Value Pairs with a Query String

name = <%= Request. Query. String("name") %>

pub = <% = Request. Query. String("pub") %>

Form Collection: Post u The name and values of the form are encoded into Form Collection: Post u The name and values of the form are encoded into the request header u Usage u variable = Request. Form(“name”)

text" src="https://present5.com/presentation/129e2051e253f6ddfa74d44d0fadc48e/image-23.jpg" alt="form. Test. html the form

text" /> form. Test. html the form text 1: radio 1: yes no select 1: select 2: (multiple) textarea 1: