Again VI6 SOM (a), to be continued ...

Source: Internet
Author: User
Tags html form html page implement object model reference
This article was originally written in HTML, there are many illustrations (Vi6 snapshot), unfortunately ...
Put it here first, Ming Mingre the HTML version.
==================================================================
Script Object Model in Visual InterDev 6.0

This article requires the following technical background:

HTML (Hyper Text Marked Language)
DHTML (Dynamic HTML)
DOM (Document Object Model)
ASP (Active Server Page)
DTC (Design Time Control)


--------------------------------------------------------------------------------

History/Client-side Scripting/server-side scripting

The main purpose of Web Site when it first appeared was to publish information (information Publish). In other words, a WEB server is more like a file server. Web Site is a collection of Web pages, each page of which is plain text in HTML format.

In order to achieve richer display capabilities, and to increase the interaction between visitors and the page, DHTML technology appears on the browser side (Client-side). DHTML is not a separate product or technology, but a collection of technologies. It was mainly integrated:

CSS (cascading Style Sheet)
DOM (Document Object Model)
Client-side Script (typical: Javascript)

In addition, almost instantaneous, people are no longer satisfied with the Web Site only to do information publishing (information Publish) platform. People want to use it to replace the previous Client/server mode, which means web apps. This is mainly in the background of the fuss, related technologies are:

CGI (Common Gateway Interface)
Isapi/nsapi/wsapi
ASP (Active Server Page)

On the Windows platform, the ASP (Active Server Page) is often selected, given the tradeoffs between performance efficiency and programming cycles. ASP technology is done by interpreting the execution of Server-side Script (usually in VBScript) on the server side (Web server Side), and it is possible to further invoke the server-side component (Server-side Component). To finally implement the browser/server (Browser/server) three-tier Web application mode.


--------------------------------------------------------------------------------

Remote scripting technology remotely scripting

In practical applications, complex WEB application systems often need to call both client script and server script. Client scripts (Client-side script) are used to complete the user interface--for example, to dynamically change Web page text, react to user actions such as double-clicking, and perform client-facing tasks such as validation. Client scripts are interpreted by the browser to provide a vivid, responsive interface to the user. and server script (Server-side script) is used to complete the business logic part of the entire application system. For example, the access to a database action.

However, client and server-side scripts are mutually exclusive, i.e. they are not visible to each other. When a page is first requested, the server may run a server script and pass the page to the browser, and then the browser can run the client script. However, if the server script on the page is necessary to run again, the page must be submitted back to the server before the server can effectively rerun the page. Maintaining the state of the controls on the page and the variables in the script may require a complex scripting (scripting) procedure to pass information back and forth between the browser and the server. This also increases network traffic and reduces the performance of WEB applications.

Example:
As you can see clearly in the Visual InterDev 6.0 programming environment, DHTML programming is completely client-side scripting technology. Accordingly, the HTML Form Element is all client-side Object. We cannot access any server-side Object in Client-side Script, and the only way to access it is to submit the page and use the Action attribute to invoke the ASP page.


One compromise is remote scripting Technology (scripting). This technique allows you to write code in a client script that invokes a method (function or routine) in an ASP page. In fact, you can invoke server scripts like local routines, but they still run on the server and have all the access to the server's capabilities. Because you never have to leave the current page and run to invoke the server script, the page state is easy to keep.

Remote scripting is implemented through a function library, which can be called directly from client script when you want to invoke a server method. The call request is passed to a proxy process in the browser, which runs asynchronously in the browser and is currently implemented as a Java applet. The agent process sends a request to the server that contains the ASP page of the method you are calling.

The server then loads the ASP page, and a special routine on the ASP page dispatches your request to the desired function. If the function you are calling has a return value, the value is sent back to the agent process, which wraps it as an object------a Call object------The object's properties contain many useful information, including the function return value.

To implement remote scripting, you will need the following files in addition to your own client (. htm) file and server (. asp) files:

Rs.htm contains a series of functions that are intended to initialize the remote scripting in the client's. htm file, to execute the remoting process, to check the status of the remote invocation, and to obtain the results of the function.
The rs.asp contains a series of functions designed to initialize the server-side remote scripting in the server-side. asp file, and to schedule the required functions in the ASP page.
Rsproxy.class contains Java class files (object code) for Java applets, which are intended to communicate between client and server Pages.
To make it easier to invoke functions on ASP pages with remote scripting, you can create object references in client scripts that reference ASP pages with server-side functions. In this way, you can use the standard Object.Method () syntax to invoke the functions exposed in the Server ASP page.


--------------------------------------------------------------------------------

Visual InterDev 6.0 Page Object

Read here, you probably think of Visual InterDev 6.0, Remote scripting is how easy to achieve. VI6 uses Page object DTC to encapsulate a lot of content, all we need to do is write a function in the ASP page and expose it using Page object. Add page Object to the foreground HTML page, help us to reference (Reference) ASP pages, and then use the functions in the background ASP page in the Client-side Script. This use differs from the previous method of Submit Form to ASP without leaving the HTML page.


Server-side
Create a Server-side ASP page.
Write a function in the ASP page.
Then use Page Object to expose it. Client-side

Create a Client-side page.
Use page Object to refer to the ASP page you want.
You can then invoke the Server-side function written in Client-side Script.

Happily, the return value of the function is passed through the property callobject.return_value of Call Object, which can be an array!

 

 



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.