WebClass to implement dynamic web programming theoretical articles

zhaozj2021-02-08  282

WebClass to implement dynamic web programming theoretical articles

(Author: Suhongtu Super 2001 at 15:50 on January 10)

For a few more time, I used to explore how to use ActiveX DLL technology to replace simple pure ASPs to implement core code and commercial logic in detail. Appropriate use of ActiveX DLL technology to have a lot of benefits when building a dynamic web site, which is obvious, but still needs a separate ASP file to create and destroy the ActiveX DLL components we have written, a large number in ASP Using ActiveX DLL is unrealistic, and our ASP programming is still not written as usual applications, because messy ASP code and HTML code are intertwined together, and, whether it is a simple ASP program or encapsulated ActiveX DLL ASP program, a biggest drawback is difficult in debugging during project development, such as difficult to set breakpoints and suspend procedures to view the value of certain variables. Is there a way to have two suites, guarantee the efficiency of developing a web program, can you easily debug and write like usual applications? The answer is of course affirmative, Microsoft introduces the concept of "WebClass" after the VB6 version, and adds a project type called "IIS Application" in the new project. WebClass is the use of Microsoft's use to make programmers to develop web programs like developing ordinary applications! Speaking of "IIS Application", everyone will think that this is the difference between the ASP program? Is the ASP not running on the web app on IIS? In fact, this is a small error in Microsoft's name, so that everyone is easier to confuse in the name. We should now clear that "IIS Applications" is the use of WebClass technology to implement and ASP's same functions, which avoids the disadvantages of ASP, such as source code is transparent, interpretation is slow. In fact, the WebClass application is also a VB component. It will be compiled with the Web application, and its running speed is greatly improved, and the source code and core technology and commercial confidential are also avoided. WebClass is essentially a VB component, which is specifically that WebClass is an ActiveX DLL. He allows you to write server-side code to respond to browser requests from users. For the user, an IIS application seems to be composed of a series of HTML pages; for developers, an IIS application consists of some special type objects called WebClass. WebClass can directly access all ASP built-in objects (Request, Response, Application, Session, Server). Any Web project developed using ASP can be implemented in WebClass. Since the concept of HTML template is introduced in WebClass, it is effective to avoid the defects from the program code in the ASP and the defects brought by HTML code, and the separation of the commercial logic layer and the final performance layer (some similar current XML) And XSL form), greatly improves the development efficiency of web projects. The IIS application is similar on the surface and the Active Server Pages application. Both applications displays dynamic Web sites and are all processed on the server instead of their processing on the client. However, each has its own unique advantages: (1) Active Server Pages are suitable for script developers who are interested in making web pages, which provides unique capabilities that mix scripts and HTML mix. (2) IIS applications are suitable for constructing a Visual Basic developer based on a web application rather than a web page. IIS applications allow complex transactions, and almost any browser or platform can easily access it.

Developing a Web project using the IIS application can have the following advantages: (1) Familiar development environment and model. You can use the Visual Basic to add classes, modules (Model), or any Visual Basic ActiveX part, which is easy to debug and write. (2) Wide use of use. Can be supported by most browser. (3) Reusable components. Similar to object-oriented programming; each object can be accessed each other. (4) Code and HTML phase separation: and write ASP applications, SERVER-side handler and Client end programs are separated, easy to maintain and modify. (5) You can customize the handling event, so write methods. Let's take a look at the specific components of WebClass: WebClass consists of HTML templates and custom WebItem. (HTML Templates and Custom WebItem Call WebItem is of course not necessarily template and custom WebItem. (1) An HTML template file is an HTML page associated with WebClass. When WebClass receives a request, it can send the browser to the HTML page. Differences for templates and conventional HTML pages only before sending pages to your browser, it often contains the replacement area that WebClass can process (usually defined by "WC @" tab). This allows you to customize your own response. (2) A custom WebItem is a program resource consisting of one or more event handlers. These event handles are called by the browser when the page load or user selects an HTML element. These event handlers can generate a response to the browser or to pass the process to another WebClass. The roughly flow of a complete WebClass application is as follows: A. Specifies a WebClass (such as Test1) as a project B initiated first. Activate this WebClass_Start event C in this WebClass (TEST1). The WriteTemplate method for calling an HTML template is called in the WebClass_Start event event in Test1, such as Check. WriteTemplate here's CHECK is a HTML template D belonging to Test1 WebClass D. If you have

exist in your check template, you will trigger this Action property, such as , then call belonging to 'xxx' This WebClass 'DDD' Project (Item); of course, this 'xxx' can be the WebClass itself you just operated, "Test1", the same, this "DDD" can be an HTML template or a WebItem. E. Item "DDD" that is "XXX" this WebClass will activate "DDD" itself's ddd_respond () event, you can do some processing here, such as retrieving database information; then call other HTML template WriteTemplate method For example, the DDD.WRITETEMPLATE method f that is called itself. Then will then call the DDD's processtag event, and the process of challenge, of course, you have the corresponding WC @ volume label in this html template.

Let's take a look at the event response in WebClass. 1. The predefined event predefined inwebclass has 3: response, processtag, useerEvent .Response event responds to the user request. The .processtag event is automatically occurred as part of the WRITETEMPLATE method. You cannot be triggered alone or to process responses. .UsRevent event: A useEREVENT process handles all user events for WebItem. The useevent event is generated by the URLFOR method at runtime. So only the hyperlink that is dynamically generated using the URLFOR method will only trigger the useerEvent event. 2. WebClass_Start () event is similar to SUB Main () in VB. So you can specify a WebClass starting with Project. You can also start with Sub Main () in the Model module. 3. Send html to your browser: There are two ways to feed back the page back to the browser. A. Use the "WRITETEMPLATE" method for the HTML template. This method activates the "Processtag" event to replace the corresponding content (part of the WC @ symbol tag) in the template. B. Dynamically generate feedback pages in the CustomWebItem event. Such as: with response .write " .write "" .write "" .write "" .write "

Hello! Universe! " .write " " End with 4. Get information from HTML : Use the Request object to get information in user input in an HTML . However, the tag properties and one event in WebClass are submitted to submit an FORM to stimulate this event in WebClass. Therefore, you can use this event to collect and operate information. 5. Dynamically replace the contents of the HTML template file: use the WriteTemplate method in 3. 6. Customize the WebItem event. Both methods and custom webItem events are associated: A. Methods with action = WebClass.asp? Wci = WebItem & WCE = 'custom event'. B. Using UrlFor (WebITEM, custom event) method. 7. Other methods of use (such as: cookie, session object, etc.) are the same in the ASP application.

转载请注明原文地址:https://www.9cbs.com/read-3482.html

New Post(0)