Introduction to WebClass (2)

Source: Internet
Author: User
Web 7. The event response in the WebClass.
$. . There are 3 predefined events in the WebClass: Response, ProcessTag, userevent
The. Response event responds to client requests.
. The ProcessTag event occurs automatically as part of the Writetemplate method processing. Cannot be triggered individually or used to process a response.
. Userevent event: A userevent procedure handles all user events for WebItem. The Userevent event is generated by the URLFor method at run time. Therefore, only hyperlinks that are dynamically generated using the URLFor method will trigger the Userevent event.
$. The Webclass_start () event is similar to the sub Main () in VB.
So you can specify a WebClass that project starts with. You can also start with sub Main () in the Model module.
$. Send HTML to Browser: There are two ways to return a page back to the browser:
The "Writetemplate" method is used for HTML templates. This method activates the "ProcessTag" event to replace the corresponding content in the template (the part marked with the wc@ symbol).
Dynamically generate feedback pages in the Customwebitem event.
such as: with response
. Write ". Write ". Write ". Write "<body>"
. Write "<p>hello! Universe!</p> "
. Write "</body>End With
$. Get information from the <form> of HTML:
Use the Request object to get the user input information in an HTML <form>. However, the <form action...> tag attribute must be connected to an event in WebClass, and a form can be submitted to fire this event in WebClass. Therefore, you can use this event to gather and manipulate information.
$. Dynamically replaces content in an HTML template file.
Use the Writetemplate method in $.
$. Custom WebItem Events.
Two methods are associated with custom WebItem events:
1: The action=webclass.asp?wci=webitem&wce= ' Custom event ' method.
2. Use URLFor (WebItem, custom event) method.
$. Other usage methods (e.g., cookie,session objects, etc.) are the same as in ASP applications
8. WebClass other properties of the role and use of the method.
$. Urldata Property
The Urldata property transmits state information between the browser and the WEB server. The Urldata property appends the information to a specific URL that the WebClass sends to the browser. When the browser submits another request using one of these URLs, the information can be passed back to the WEB server for further processing. In this way, you can send and get status information without storing the information at both ends.

The Urldata property provides several advantages:
 It can be used in browsers that do not support cookies.
It stores state information in the page itself. Therefore, if the user uses the Back button and submits the page again, WebClass receives the same status data as the page originally sent.

Urldata has two disadvantages:
First, Urldata is restricted in the number of data sent. The size limit varies depending on the browser, but most browsers can handle approximately 2K of data in the URL. In your application, you should test the length of the URL you intend to use.
Second, if you use a form with a Get method, Urldata is an infeasible way to send information. In this case, you can use the POST method, or use a different method to transfer the state. (for example, cookies or use hidden fields to transfer small amounts of information.)


The Urldata property can use the WebClass response to add information to the URL in both cases, appending the specified information to a parameter that contains a name called WCU. (..... Webclass.asp? Wci=webitem&wce=webevent&wcu=urldata)
When WebClass calls a Writetemplate method.
Such as:...............
Urldata= "userno:1234"
Webitem.writetemplate
..................

When WebClass calls a URLFor method. (Method Ibid.).

$. The StateManagement attribute in the WebClass.
When WebClass's StateManagement property is set to Wcnostate, information cannot be saved in the WebClass object of the server. That is, you cannot save state information with Urldata.

$. Nameinurl property.
specified for each WebClass location. ASP files.



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.